Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
34
Placing segments in memory
AVR® IAR C/C++ Compiler
Reference Guide
For detailed information about individual segments, see the chapter Segment reference 
in Part 2. Compiler reference
Segment memory type 
XLINK assigns a segment memory type to each of the segments. In some cases, the 
individual segments may have the same name as the segment memory type they belong 
to, for example 
CODE
. Make sure not to confuse the individual segment names with the 
segment memory types in those cases.
By default, the 
AVR IAR C/C++ Compiler
 uses only the following XLINK segment 
memory types:
XLINK supports a number of other segment memory types than the ones described 
above. However, they exist to support other types of microcontrollers. 
For more details about segments, see the chapter Segment reference.
Placing segments in memory
The placement of segments in memory is performed by the IAR XLINK Linker. It uses 
a linker command file that contains command line options which specify the locations 
where the segments can be placed, thereby assuring that your application fits on the 
target chip. You can use the same source code with different derivatives just by 
rebuilding the code with the appropriate linker command file.
In particular, the linker command file specifies:
The placement of segments in memory
The maximum stack size
The maximum heap size (only for the IAR DLIB runtime environment).
This section describes the methods for placing the segments in memory, which means 
that you have to customize the linker command file to suit the memory layout of your 
target system. For showing the methods, fictitious examples are used.
Segment memory type
Description
CODE
For executable code in flash memory space
DATA
For data placed in data memory space (RAM), 
and for data placed in flash memory space
XDATA
For data placed in EEPROM memory space
Table 9: XLINK segment memory types