Microchip Technology SW006023-2N データシート

ページ / 238
MPLAB
®
 XC32 C/C++ Compiler User’s Guide
DS51686E-page 106
 2012 Microchip Technology Inc.
Finally, note that “small” data and bss (.sdata, .sbss, etc.) sections are still mapped 
in the built-in default linker script. This is because “small” data variables must be 
grouped together so that they are within range of the more efficient GP-relative 
addressing mode. To avoid conflict with these linker-script mapped sections, choose 
high addresses for your absolute-address variables.
aligned (n)
The attributed variable will be aligned on the next n byte boundary.
The aligned attribute can also be used on a structure member. Such a member will 
be aligned to the indicated boundary within the structure.
If the alignment value n is omitted, the alignment of the variable is set 8 (the largest 
alignment value for a basic data type).
Note that the aligned attribute is used to increase the alignment of a variable, not 
reduce it. To decrease the alignment value of a variable, use the packed attribute.
cleanup (function)
Indicate a function to call when the attributed automatic function scope variable goes 
out of scope.
The indicated function should take a single parameter, a pointer to a type compatible 
with the attributed variable, and have void return type.
deprecated
deprecated (msg)
When a variable specified as deprecated is used, a warning is generated. The 
optional msg argument, which must be a string, will be printed in the warning, if present.
packed
The attributed variable or structure member will have the smallest possible alignment. 
That is, no alignment padding storage will be allocated for the declaration. Used in 
combination with the aligned attribute, packed can be used to set an arbitrary 
alignment restriction greater or lesser than the default alignment for the type of the 
variable or structure member.
section (“section-name”)
Place the variable into the named section.
For example,
unsigned int dan __attribute__ ((section (“.quixote”)))
Variable dan will be placed in section .quixote.
The -fdata-sections command line option has no effect on variables defined with 
a section attribute unless unique_section is also specified.
Note:
In almost all cases, you will want to combine the address attribute with the 
space attribute to indicate code or data.