Atmel CAVR-4 Manual De Usuario
![Atmel](https://files.manualsbrain.com/attachments/0369829915bda09f9c2e00fb805a7753579683b5/common/fit/150/50/8d2bf08978ec3e5bc63f4343ac5e91ce8d0e40045619fa520d910d64af8f/brand_logo.png)
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.
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
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 None, Low, and Medium, unless
the option
the option
--do_cross_call
is used.
To read more about related command line options, see --no_cross_call, page 189,
--do_cross_call, page 179, and --cross_call_passes, page 174.
--do_cross_call, page 179, and --cross_call_passes, page 174.
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:
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:
strings:
●
In external ROM in the data memory space
●
In internal RAM in the data memory space
●
In flash in the code memory space.
To read more about this, see Initialized data, page 39.