Specifications
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