25.4.13 Assigning Objects to Sections
The __section()
specifier can be used to indicate that an object should
be located in the named section. This is typically used when the object has special and
unique linking requirements that cannot be addressed by existing compiler features.
Use the native keywords discussed in the Differences section to look up information on the semantics of this specifier.
Example
The following shows a variable which uses the __section
keyword.
int __section("comSec") commonFlag;
Differences
When targeting AVR MCUs using the MPLAB XC8 compiler or when using the other compilers,
the section
attribute has been used to indicate a different destination
section name. The __section()
specifier works in a similar way to the
attribute.
Migration to the CCI
section
attribute, for
example,
from:int __attribute__((section("myVars"))) intMask;
to:int __section("myVars") intMask;
Caveats
None.