miniwinwm
Newbie level 3
If I have a ragged array of strings, defined like this...
with GCC the strings go into flash memory but the array of char pointers goes into RAM. I know I can force both parts into flash by creating a section in the linker script and referring to it in the source code before the array definition, but this then means that my code is compiler specific and also depends on an outside file as well (the linker script). Is anyone aware of any trick using only standard C99 that will get all parts into flash memory so that it compiles and does what I want with both GCC and other different compilers?
Code:
static const char * const labels[] = {"Elk", "Horse", "Hog"};
with GCC the strings go into flash memory but the array of char pointers goes into RAM. I know I can force both parts into flash by creating a section in the linker script and referring to it in the source code before the array definition, but this then means that my code is compiler specific and also depends on an outside file as well (the linker script). Is anyone aware of any trick using only standard C99 that will get all parts into flash memory so that it compiles and does what I want with both GCC and other different compilers?