Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
208
Descriptions of extended keywords
AVR® IAR C/C++ Compiler
Reference Guide
Using the 
strcpy_P
 function declared in 
pgmspace.h
, a string in flash memory can be 
copied to another string in RAM as follows:
strcpy_P(dest, msg);
_ _generic
Declares a generic pointer.
The 
_ _generic
 pointer type attribute declares a generic pointer that can point to 
objects in both code and data space. The size of the generic pointer depends on which 
processor option is used:
The most significant bit (MSB) determines whether 
_ _generic
 points to Code 
(MSB=1) or Data (MSB=0).
It is not possible to place objects in a generic memory area, only to point to it. When 
using generic pointers, make sure that objects that have been declared 
_ _far
 and 
_ _huge
 are located in the range 
0x0–0x7FFFFF
. Objects may still be placed in the 
entire data address space, but a generic pointer cannot point to objects in the upper half 
of the data address space.
The 
_ _generic
 keyword cannot be used with the 
#pragma type_attribute
 
directive for a pointer.
Access through a 
_ _generic
 pointer is implemented with inline code. Because this 
type of access is slow and generates a lot of code, 
_ _generic
 pointers should be 
avoided when possible.
_ _huge
Controls the storage of data objects in data memory space.
The 
_ _huge
 memory attribute overrides the default data storage of variables given by 
the selected memory model.
Address range
Max object size
Pointer size
Memory space
0-0xFFFF
 (64 Kbytes)
65535 bytes
16 bits
Code
Table 60: Flash address ranges
Processor option
Generic pointer size
Memory space
-v0
, -v1
1 + 15 bits
Data/Code
-v2
 to -v6
1 + 23 bits
Data/Code
Table 61: Generic pointer size
Address range
Max object size
Pointer size
Memory space
0-0xFFFFFF
 (16 Mbytes)
16 Mbytes
24 bits
Data
Table 62: Huge address ranges