Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
16
Introduction
AVR® IAR C/C++ Compiler
Reference Guide
On the heap. Once memory has been allocated on the heap, it remains valid until it 
is explicitly released back to the system by the application. This type of memory is 
useful when the number of objects is not known until the application executes. Note 
that there are potential risks connected with using the heap in systems with a limited 
amount of memory, or systems that are expected to run for a long time.
EXTENDED KEYWORDS FOR DATA
The extended keywords that can be used for data control the following:
For data memory space, keywords that control the placement and type of objects 
and pointers: 
_ _tiny
_ _near
_ _far
_ _huge
, and 
_ _regvar
For the EEPROM memory space, keyword that controls the placement and type of 
objects and pointers: 
_ _eeprom
For the code (flash) memory space, keywords that control the placement and type of 
objects and pointers: 
_ _tinyflash
_ _flash
_ _farflash
, and 
_ _hugeflash
For the I/O memory space, keyword that controls the placement and type of objects 
and pointers: 
_ _ext_io
_ _io
Special pointer that can access data objects in both data and code memory space: 
_ _generic
Other characteristics of objects: 
_ _root
 and 
_ _no_init
.
See the chapteData storage in Part 1. Using the compiler for more information about 
how to use data memory types.
Syntax
The keywords follow the same syntax as the type qualifiers 
const
 and 
volatile
. The 
following declarations place the variable 
i
 and 
j
 in EEPROM memory. The variables 
k
 
and 
l
 behave in the same way:
_ _eeprom int i, j;
int _ _eeprom k, l;
Note that the keyword affects both identifiers.
In addition to the rules presented here—to place the keyword directly in the code—the 
directives 
#pragma
 
type_attribute
 and 
#pragma
 
object_attribute
 can be used 
for specifying the keywords. Refer to the chapter Pragma directives for details about 
how to use the extended keywords together with pragma directives.
Pointers
A keyword that is followed by an asterisk (
*
), affects the type of the pointer being 
declared. A pointer to EEPROM memory is thus declared by:
char _ _eeprom * p;