A linker-generated output section collects selected input sections and assigns them an address and memory region. In bare-metal Cortex-M layouts, output sections place the vector table, code, and static data in FLASH or RAM. section 4.1.3
Common output-section mappings include:
- .vector_table, .text, and .rodata are placed in FLASH. section 4.1.3
- .data is placed in RAM with its load address in FLASH; .bss is placed in RAM as NOLOAD. section 4.1.3
SECTIONS
{
.vector_table :
{
LONG(ORIGIN(RAM) + LENGTH(RAM)); /* Initial stack pointer (
top of RAM) */
KEEP(*(.vector_table.reset_vector)) /* Reset vector (
entry point) */
KEEP(*(.vector_table.exceptions)) /* Other exceptions and
interrupts */
} > FLASH
See linker-script syntax for collecting vector-table entries and placing the output section in FLASH. section 4.1.3
