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.
BIND, ADDR, and SIZEOF example shows an 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 .
The dot keyword (" . "), is a convenient way to set the linker's place in the current output section.
Skipping areas of memory shows an example.
SECTIONS
{
GROUP :
{
.ISR_Table : {}
. = 0x2000
} > flash
GROUP :
{
.paramsection : {}
} > flash
}
This example defines two sections. The first section, .ISRTable , will be loaded at beginning of the memory area named flash on the target platform at runtime. The second section, .paramsection , will be loaded at the address that is 0x2000 bytes past the beginning of the memory area named flash .