3.6 __flash Keyword
The IAR __flash
keyword places objects in the first 64 KB segment of program
memory and when used with the definition of a pointer, that pointer can access objects
in this same segment.
Suggested Replacement
There is an identical MPLAB XC8 qualifier; alternatively, the qualifier can be removed when an MPLAB XC8 memory-placement feature is in effect.
The MPLAB XC8 compiler implements a __flash
keyword with the same
behavior, so this IAR keyword does not need to be removed or replaced.
Alternatively, when enabled (the default state), the MPLAB XC8's
const-data-in-program-memory feature places const
objects into
program memory. In this case, the IAR keyword is redundant and can be removed.
Caveats
The const
qualifier must be used with the __flash
qualifier when using MPLAB XC8, whereas this is only preferable when using
__flash
with IAR.
Further Information
See the Special Type Qualifiers and Options Specific to AVR Devices sections in the MPLAB XC8 C Compiler User's Guide for AVR MCUs for more information on this qualifier and option.