Atmel CAVR-4 Manuale Utente

Pagina di 323
CAVR-4
Part1. Using the compiler
Efficient coding for embedded applications
125
Clustering of variables
When clustering of variables is enabled, static and global variables are arranged so that 
variables that are accessed in the same function are stored close to each other. This 
makes it possible for the compiler to use the same base pointer for several accesses.
Note: This option has no effect at optimization levels None and Low.
Cross call
 
Common code sequences are extracted to local subroutines. This optimization, which is 
performed at optimization level High, can reduce code size, sometimes dramatically, on 
behalf of execution time and stack size. The resulting code might however be difficult 
to debug. This optimization cannot be disabled using the 
#pragma optimize
 directive.
Note: This option has no effect at optimization levels NoneLow, and Medium, unless 
the option 
--do_cross_call
 is used.
Selecting data types and placing data in memory
For efficient treatment of data, you should consider the data types used and the most 
efficient placement of the data.This section provides useful information for efficient 
treatment of data:
LOCATING STRINGS IN ROM, RAM AND FLASH
With the AVR IAR C/C++ Compiler there are three possible locations for storing 
strings:
In external ROM in the data memory space
In internal RAM in the data memory space
In flash in the code memory space.