A linker section is a named group of program symbols, such as code, data, or vector-table entries. Rust’s `#[unsafe(link_section = "...")]` tags a symbol with a section name; the linker script—not the attribute—assigns that section to a physical memory region. section 5.4.4
In bare-metal Rust, named sections help organize firmware symbols for specific linker-script placement:
- Place core exceptions and device interrupt handlers in order within the vector table in flash. section 4.2.3 section 4.5.4
- Tag a buffer for a custom section and map it to DTCM for predictable data access. section 5.4.4
- Reserve a section for defmt format strings and logging metadata; transport crates configure it automatically in normal use. section 6.3.3
MEMORY {
ITCM : ORIGIN = 0x00000000, LENGTH = 64K
DTCM : ORIGIN = 0x20000000, LENGTH = 64K
FLASH : ORIGIN = 0x08000000, LENGTH = 1M
}
SECTIONS {
.tcm_data (NOLOAD) : ALIGN(4) {
KEEP(*(.tcm_data*))
} > DTCM
}
This linker-script example defines memory regions and maps the custom .tcm_data section into DTCM. section 5.4.4
