Atmel CAVR-4 Manuale Utente

Pagina di 323
CAVR-4
Part 2. Compiler reference
Compiler options
195
--root_variables
--root_variables
Use this option to apply the 
_ _root
 extended keyword to all global and static variables. 
This will make sure that the variables are not removed by the IAR XLINK Linker.
Notice that the 
--root_variables
 option is always available, even if you do not 
specify the compiler option 
-e
, language extensions. 
This option is related to the Code options in the C/C++ Compiler category in IAR 
Embedded Workbench.
-s
-s[2|3|6|9] 
Use this option to make the compiler optimize the code for maximum execution speed. 
If no optimization option is specified, the compiler will use the size optimization 
-z2
 
by default. If the 
-s
 option is used without specifying the optimization level, speed 
optimization at level 2 is used by default. 
The following table shows how the optimization levels are mapped:
*The most important difference between 
-s2
 and 
-s3
 is that at level 2, all non-static variables 
will live during their entire scope.
A low level of optimization makes it relatively easy to follow the program flow in the 
debugger, and, conversely, a high level of optimization makes it relatively hard.
Note: The 
-s
 and 
-z
 options cannot be used at the same time. 
To set the equivalent option in IAR Embedded Workbench, select 
Project>Options>C/C++ Compiler>Code.
--segment
--segment memory_attribute=segment_name
Use this option to place all variables or functions with the memory attribute 
memory_attribute
 in segments with names that begin with 
segment_name
For example, the following command places the 
_ _near int a;
 variable in the 
FOO_Z
 
segment:
--segment _ _near=FOO
Option modifier
Optimization level
2
None* (Best debug support)
3
Low*
6
Medium
9
High (Maximum optimization)
Table 50: Specifying speed optimization (-s)