SLAU131Y October 2004 – June 2021
The MEMORY and SECTIONS directives provide flexible methods for building, combining, and allocating sections. However, any memory locations or sections you choose not to specify must still be handled by the linker. The linker uses algorithms to build and allocate sections in coordination with any specifications you do supply.
If you do not use the MEMORY and SECTIONS directives, the linker allocates output sections as though the memory map and section definitions were as shown in Default Allocation for MSP430 Devices were specified.
MEMORY
{
MEM : origin = 0x0200, length = 0xFDFD
RESET : origin = 0xFFFE, length = 0x0002
}
SECTIONS
{
.text : {} > MEM
.const : {} > MEM
.data : {} > MEM
.bss : {} > MEM
.reset : > RESET
.cinit : {} > MEM ;cflag option only
.pinit : {} > MEM ;cflag option only
}
See Section 3.6.1 for information about default memory allocation.
All .text input sections are concatenated to form a .text output section in the executable output file, and all .data input sections are combined to form a .data output section.
If you use a SECTIONS directive, the linker performs no part of this default allocation. Instead, allocation is performed according to the rules specified by the SECTIONS directive and the general algorithm described next in Section 9.8.1.