I am using the IAR C compiler for the Renesas M16C and have in my code a string array declared as
const unsigned char * TestResultString[NUM_LANGUAGES][3] = { { "PASS", "FAIL", "INCOMPLETE" }, }; (NUM_LANGUAGES is currently 1 but will be increased later)
When I examine the resultant code it puts the text in code space but the pointers are copied at runtime from code memory to RAM (into the FAR_I segment). They are never changed during program operation so this would seem to be unnecessary as the originals naturally remain where they were copied from.
As I expand the text this will eat away at my RAM so how can I change it so that it keeps the pointers located in code memory?
One way would be to make the array have a fixed size like this
const unsigned char TestResultString[NUM_LANGUAGES][3][11] = { { "PASS", "FAIL", "INCOMPLETE" }, };
but this is quite wasteful of code memory as some of them have wide variations in the lengths of their elements.
I'm sure it is quite simple but I can't figure out what it is.
Thanks for any advice.