Specifying Memory Area Locations and Sizes. NXP CodeWarrior Development Studio
Annonce
Annonce
Specifying Memory Area Locations and Sizes
Use the
ALIGN
argument in a
SECTIONS
or
GROUP
directive to specify an alignment relative to the start of the physical address.
shows an example.
Listing 13-7. Example of the ALIGN directive
SECTIONS
{
GROUP:
{
.init ALIGN(0x1000) : {}
.text ALIGN(0x1000) : {}
} > text
}
This example defines two sections named
.init
and
.text
. At runtime, each section will be loaded at the next available address that is evenly divisible by
0x1000
in the memory area named text
on the target platform.
13.7 Specifying Memory Area Locations and Sizes
Normally, the linker stores sections in the output file in sequential order. Each object from the linker's output is stored after the last object in the output file. Use the
BIND
,
ADDR
, and
SIZEOF
keywords in
SECTIONS
and
GROUP
directives to precisely specify where sections in the output file will be loaded.
shows an example.
Listing 13-8. BIND, ADDR, and SIZEOF example
SECTIONS
{
.text BIND(0x00010000) : ()
.rodata : {}
.data BIND(ADDR(.rodata + SIZEOF(.rodata)) ALIGN(0x010) : {}
}
This example defines a section in the output file named
.text
. This section will be loaded at address
0x00010000
on the target platform at runtime. The next section,
.rodata
, will be loaded at the address immediately proceeding the last byte in the
.text
section. The last section,
.data
, will be loaded at the address that is the sum of the beginning of the
.rodata
section's address and the size of the
.rodata
section. This last section will be aligned at the next address that is evenly divisible by
0x10
.
CodeWarrior Development Studio for Advanced Packet Processing Build Tools Reference Manual, Rev.
10.2, 01/2016
210 Freescale Semiconductor, Inc.
Download
Annonce