Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
Part 1. Using the compiler
Placing code and data
37
Note: Copy initialization segments—
BASENAME_I
 and 
BASENAME_ID
—must be 
placed using -Z.
Data segments
This section contains descriptions of the segments used for storing the different types of 
data—static, stack, heap, and located. In moste cases these segments are located in the 
data memory space. However, some of the segments are located in the code memory 
space.
To get a clear understanding about how the data segments work, you must be familiar 
with the different memory types and the different memory models available in the 
AVR 
IAR C/C++ Compiler
. If you need to refresh these details, see the chapter Data storage.
STATIC MEMORY SEGMENTS 
Static memory is memory that contains variables that are global or declared static, as 
described in the chapter Data storage. Declared static variables can be divided into the 
following categories:
Variables that are initialized to a non-zero value
Variables that are initialized to zero
Variables that are located by use of the 
@
 operator or the 
#pragma location
 
directive
Variables that are declared as 
const
 and therefore can be stored in external ROM
Variables defined with the 
_ _no_init
 keyword, meaning that they should not be 
initialized at all.
For the static memory segments it is important to be familiar with:
The segment naming
How the memory types correspond to segment groups and the segments that are part 
of the segment groups
Restrictions for segments holding initialized data
The placement and size limitation of the segments of each group of static memory 
segments. 
Segment naming
All static data segment names consist of two parts—the segment base name and a 
suffix—for instance, 
NEAR_Z
. The segment base names are derived from the memory 
type attributes, for example the attribute:
_ _near