3.27 __tinyflash Keyword
The IAR __tinyflash
keyword places and accesses objects from program memory in
the address range of 0-0xFF, using 8-bit pointers., which has an addressable range
0x0-FF. Pointers qualified with this keyword are 8 bits wide and can point to any
address in this range.
Suggested Replacement
There is an MPLAB XC8 specifier that performs a similar tasks to this keyword, but there are some differences in its effect.
Use the __flash
specifier to have objects placed in program
memory.
Caveats
This MPLAB XC8 specifier will place objects in the first 64 KB of program memory and pointers and addresses to this space will be 16 bits wide. Programs using this specifier will execute correctly, unless the program makes explicit assumptions that addresses are 8-bits wide.
The const
qualifier must be used with the __flash
qualifier when using MPLAB XC8, whereas this is not necessary when using
__flash
with IAR.
Examples
__tinyflash int mode;
volatile int x;
int main(void) {
x = mode;
}
to
MPLAB XC8 code similar
to:#include <xc.h>
const __flash int mode;
volatile int x;
int main(void) {
x = mode;
}
Further Information
See the Special Type Qualifiers section in the MPLAB XC8 C Compiler User's Guide for AVR MCUs for more information on this qualifier.