Friday, July 22, 2011

[AVR] attribute

GCC has a special keyword, __attribute__ that is used to attach different attributes
to things such as function declarations, variables, and types. This keyword is
followed by an attribute specification in double parentheses. In AVR GCC, there is a
special attribute called progmem. This attribute is use on data declarations, and tells
the compiler to place the data in the Program Memory (Flash).
AVR-Libc provides a simple macro PROGMEM that is defined as the attribute syntax of
GCC with the progmem attribute. This macro was created as a convenience to the end
user, as we will see below. The PROGMEM macro is defined in the
system header file.
It is difficult to modify GCC to create new extensions to the C language syntax, so instead,
avr-libc has created macros to retrieve the data from the Program Space. These
macros are also found in the system header file.

No comments:

Post a Comment