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.

Table 5-1. Attributes that Modify Sections
Section AttributeDescriptionApplicable Section TypesCompatible 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, bsscoherent, memory, noload, nopa, persist, ramfunc
coherentAllocate the PIC32M section to the kseg1 (uncached) memory region.data, bssaddress, memory, persist, noload
dtcmAllocate the PIC32 C/SAM section to data TCM.data, bssnoload, persist
itcmAllocate the PIC32 C/SAM section to instruction TCM and have it initialized by dinit.codenoload, nopa
keepPrevent the linker from garbage collecting the sectioncode, data, bssaddress, coherent, dtcm, itcm,memory, nopa, persist, ramfunc
memory(mem)Allocate the PIC32M section to the specified user-defined memory region, mem.code, data, bssaddress, coherent, noload, nopa, ramfunc
noloadAllocate 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, bssaddress, coherent, dtcm, itcm,memory, nopa, persist, ramfunc
nopaPerform no procedural abstraction on this PIC32C/SAM section.codeaddress, itcm,memory, ramfunc
persistAllocate section to RAM but do not initialize it with dinit.bssaddress, coherent, dtcm, noload
ramfuncAllocate the section to RAM and have it initialized by dinit.codeaddress,memory, noload, nopa