Memory management - How storing constants in PRAM space?
Posted: 31 Dec 2016 16:51
How can I store constants (mainly big tables) into the program memory space to keep the 2kB data RAM available for the stack and variables?
Background information about my question:
I use in my application a large constant lookup table (a font table) that is placed by the compiler into the variable space (reduced to 5 bytes for the example here):
I tried to declare as constant and or static constant. However this doesn't change anything; the compiler continues to place them into the variable space:
So I tried using some known 8051 compiler directives to force the compiler using the program memory space, but all the following declarations are generating compilation errors:
Is there another compilation directive or a trick that can be used to select the program memory space?
Background information about my question:
I use in my application a large constant lookup table (a font table) that is placed by the compiler into the variable space (reduced to 5 bytes for the example here):
Code: Select all
unsigned char LuTable[] = {0x10, 0x21, 0x31, 0x41, 0x50};
Code: Select all
const char LuTable[] = {0x10, 0x21, 0x31, 0x41, 0x50};
static const unsigned char LuTable[] = {0x10, 0x21, 0x31, 0x41, 0x50};
Code: Select all
static const char CODE LuTable[] = {0x10, 0x21, 0x31, 0x41, 0x50};
CODE static const char LuTable[] = {0x10, 0x21, 0x31, 0x41, 0x50};
static const char code LuTable[] = {0x10, 0x21, 0x31, 0x41, 0x50};
code static const char LuTable[] = {0x10, 0x21, 0x31, 0x41, 0x50};
__code unsigned char LuTable[] = {0x10, 0x21, 0x31, 0x41, 0x50};
unsigned char __code LuTable[] = {0x10, 0x21, 0x31, 0x41, 0x50};