Tailoring the image memory map to your target hardware
You can use a scatter file to define a memory map, giving you control over the placement of data and code in memory.
In your final embedded system, without semihosting functionality, you are unlikely to use the default memory map. Your target hardware usually has several memory devices located at different address ranges. To make the best use of these devices, you must have separate views of memory at load and run-time.
Scatter-loading enables you to describe the load and run-time memory locations of code and
data in a textual description file known as a scatter file. This file is passed to the
linker on the command line using the
--scatter option. For example:
armlink --scatter scatter.scat file1.o file2.o
Scatter-loading defines two types of memory regions:
Load regions containing application code and data at reset and load-time.
Execution regions containing code and data when the application is executing. One or more execution regions are created from each load region during application startup.
A single code or data section can only be placed in a single execution region. It cannot be split.
During startup, the C library initialization code in
out the necessary copying of code/data and zeroing of data to move
from the image load view to the execute view.
The overall layout of the memory maps of devices based around the Arm®v6‑M and Armv7‑M architectures are fixed. This makes it easier to port software between different systems based on these architectures.