Atmel CAVR-4 ユーザーズマニュアル
CAVR-4
46
Code segments
AVR® IAR C/C++ Compiler
Reference Guide
LOCATED DATA
A variable that has been explicitly placed at an address, for example by using the
compiler
compiler
@
syntax, will be placed in either the
SEGMENT_AC
or the
SEGMENT_AN
segment. The former is used for constant-initialized data, and the latter for items
declared as
declared as
_ _no_init
. The individual segment part of the segment knows its location
in the memory space, and it should not be specified in the linker command file.
USER-DEFINED DATA SEGMENTS
If you create your own data segments—see Controlling data and function placement,
page 47—these must also be defined in the linker command file using the
page 47—these must also be defined in the linker command file using the
-Z
or
-P
segment control directives.
Code segments
This section contains examples and descriptions of the segments used for storing code,
in other words, functions, and the interrupt vector table. Typically, these segments are
placed in the code memory space (flash).
in other words, functions, and the interrupt vector table. Typically, these segments are
placed in the code memory space (flash).
The
-Z
command is used for defining all segments in the following examples. The
addresses used in the examples are based on the assumed target system described in the
Table 10, Memory layout of a target system (example), on page 35. Note that because
the described target system is limited in size of code memory space, several segments
supported by the compiler are not applicable for this target system.
Table 10, Memory layout of a target system (example), on page 35. Note that because
the described target system is limited in size of code memory space, several segments
supported by the compiler are not applicable for this target system.
For a complete list of all segments, see Summary of segments, page 149.
INTERRUPT AND RESET VECTORS
The interrupt vector table contains pointers to interrupt routines, including the reset
routine. The table is placed in the segment
routine. The table is placed in the segment
INTVEC
. The AT90S80515 derivative has 13
interrupt vectors and one reset vector. For this reason, you should specify 14 interrupt
vectors, each of two bytes.
vectors, each of two bytes.
The linker directive would then look like this:
-Z(CODE)INTVEC=0-1B /* 14 interrupt vectors; 2 bytes each */
FUNCTIONS
Functions are placed in the
CODE
or
FARCODE
segments, depending on which
-v
processor option you are using. The
-v
option implicitly determines the default function
memory attributes
_ _nearfunc
or
_ _farfunc
, which in turn determines the used
segments for the functions. For information about which attribute is used by default for
each
each
-v
option, see the Table 3, Summary of processor configuration, on page 8.