C3.1.4 Methods of specifying an image memory map with the linker
An image can consist of any number of regions and output sections. Regions can have different load and execution addresses.
When constructing the memory map of an image, armlink must have
information about:
How input sections are grouped into output sections and regions.
Where regions are to be located in the memory map.
Depending on the complexity of the memory map of the image, there are two
ways to pass this information to armlink:
Command-line options for simple memory map descriptions
You can use the following options for simple cases where an image has only one or two
load regions and up to three execution regions:
--first.
--last.
--ro_base.
--rosplit.
--rw_base.
--split.
--xo_base.
--zi_base.
These options provide a simplified notation that gives the same settings as a
scatter-loading description for a simple image. However, no limit checking for regions
is available when using these options.
Scatter file for complex memory map descriptions
A scatter file is a textual description of the memory layout and code
and data placement. It is used for more complex cases where you require complete control
over the grouping and placement of image components. To use a scatter file, specify
--scatter=filename at the command-line.
Note:
You cannot use --scatter with the other memory map related
command-line options.
Table
C3-2 Comparison of scatter file and equivalent command-line options
Scatter file
Equivalent command-line options
LR1 0x0000 0x20000
{
ER_RO 0x0 0x2000
{
--ro_base=0x0
init.o (INIT, +FIRST)
*(+RO)
}
--first=init.o(init)
ER_RW 0x400000
{
*(+RW)
}
--rw_base=0x400000
ER_ZI 0x405000
{
*(+ZI)
}
}
--zi_base=0x405000
LR_XO 0x8000 0x4000
{
ER_XO 0x8000
{
*(XO)
}
}
--xo_base=0x8000
Note:
If XO sections are present, a separate load and execution region is
created only when you specify --xo_base. If you do not specify --xo_base, then the ER_XO region is placed in the
LR1 region at the address specified by --ro_base. The ER_RO region is then placed immediately after the ER_XO
region.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.