Specifications

CAVR-4
Part 2. Compiler reference
149
Segment reference
The AVR IAR C/C++ Compiler places code and data into named segments
which are referred to by the IAR XLINK Linkerâ„¢. Details about the segments
are required for programming assembler language modules, and are also useful
when interpreting the assembler language output from the compiler.
For information about how to define segments in the linker command file, see
Customizing the linker command file, page 35.
Summary of segments
The table below lists the segments that are available in the AVR IAR C/C++ Compiler.
Note that located denotes absolute location using the @ operator or the #pragma
location directive. The XLINK segment memory type CODE, DATA, or XDATA
indicates whether the segment should be placed in ROM or RAM memory areas; see
Table 9, XLINK segment memory types, page 34.
Segment Description Type
CODE Holds program code declared __nearfunc. CODE
CSTACK Holds the stack used by C or C++ programs. DATA
DIFUNCT Holds pointers to constructor blocks that should be executed by the
system startup code before main is called.
CODE
EEPROM_AN Holds initialized located __eeprom variables. XDATA
EEPROM_I Holds non-zero initialized static and global __eeprom variables. XDATA
EEPROM_N Holds __no_init static and global __eeprom variables. XDATA
FARCODE Holds program code declared __farfunc. CODE
FAR_C Holds __far declared constant data, including literal strings. DATA
FAR_F Holds static and global __farflash variables. CODE
FAR_HEAP Holds the heap used for dynamically allocated data in far memory using
the DLIB library.
DATA
FAR_I Holds non-zero initialized static and global __far variables. DATA
FAR_ID Holds initial values for the variables located in the FAR_I segment. CODE
FAR_N Holds __no_init static and global __far variables. DATA
FAR_Z Holds zero-initialized static and global __far variables. DATA
Table 38: Segment summary