Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
Part 1. Using the compiler
Placing code and data
35
CUSTOMIZING THE LINKER COMMAND FILE
The only change you will normally have to make to the supplied linker command file is 
to customize it so it reflects the target system memory map. 
As an example, we can assume that the target system has the following memory layout:
The flash memory can be used for storing both 
CODE
 and 
DATA
 segment memory types. 
The RAM memory can contain segments of 
DATA
 type. The main purpose of 
customizing the linker command file is to verify that your application code and data do 
not cross the memory range boundaries, which would lead to application failure.
The contents of the linker command file
The 
config
 directory contains ready-made linker command files. The file contains the 
information required by the linker, and is ready to be used. If, for example, your 
application uses additional external RAM, you need to add details about the external 
RAM memory area. Remember not to change the original file. We recommend that you 
make a copy in the working directory, and modify the copy instead.
Note: The supplied linker command file includes comments explaining the contents.
Among other things, the linker command file contains three different types of XLINK 
command line options:
The CPU used:
-ca90
This specifies your target microcontroller. 
Definitions of constants used later in the file. These are defined using the XLINK 
option 
-D
.
The placement directives (the largest part of the linker command file). Segments can 
be placed using the 
-Z
 and 
-P
 options. The former will place the segment parts in 
the order they are found, while the latter will try to rearrange them to make better 
use of the memory. The 
-P
 option is useful when the memory where the segment 
should be placed is not continuous. 
Note: In the linker command file, all numbers are specified in hexadecimal format. 
However, neither the prefix 
0x
 nor the suffix 
h
 is used.
Range
Type
0x100
–0xFFF
RAM
0x0
–0x1FFFF
FLASH
0x0
–0xFFF
EEPROM
0x1000
–0xFFFF
External RAM
Table 10: Memory layout of a target system (example)