5.1.5.1 Section Attributes
The extended section attributes refine how a section is handled. The may be specified in any order and are case-insensitive. Two categories of section attributes exist: attributes that represent section types and attributes that modify section types.
MPLAB XC32 C Compiler implements three
section type attributes: code, data, and
bss, based on the ELF section type and flags.
The following table lists all the extended attributes and their purpose. For each attribute, the sections with which they can be used are indicated, as well which other section attributes that can be used concurrently.
| Section Attribute | Description | Applicable Section Types | Compatible Attributes |
|---|---|---|---|
address(addr) | Allocate the section at the specified address,
addr. Ignore any other flag that would
set the memory region for the section. | code, data, bss | coherent, memory,
noload, nopa, persist,
ramfunc |
coherent | Allocate the PIC32M section to the kseg1 (uncached) memory region. | data, bss | address, memory,
persist, noload |
dtcm | Allocate the PIC32 C/SAM section to data TCM. | data, bss | noload, persist |
itcm | Allocate the PIC32 C/SAM section to instruction TCM and have it initialized by dinit. | code | noload, nopa |
keep | Prevent the linker from garbage collecting the section | code, data, bss | address, coherent, dtcm,
itcm,memory, nopa,
persist, ramfunc |
memory(mem) | Allocate the PIC32M section to the specified user-defined memory region,
mem. | code, data, bss | address, coherent,
noload, nopa,
ramfunc |
noload | Allocate and place the section as usual in the ELF executable, but do not load by a program loader, such as bin2hex. The sections are not initialized by dinit and are a way of reserving space in memory. Intended for data objects that are never referenced. | code, data, bss | address, coherent, dtcm,
itcm,memory, nopa,
persist, ramfunc |
nopa | Perform no procedural abstraction on this PIC32C/SAM section. | code | address, itcm,memory,
ramfunc |
persist | Allocate section to RAM but do not initialize it with dinit. | bss | address, coherent, dtcm,
noload |
ramfunc | Allocate the section to RAM and have it initialized by dinit. | code | address,memory, noload,
nopa |
