Absolute location of constant tables in code space

I'm looking for a way to absolutely locate a constant array in code space using the C51 compiler. I can use the 'code' memory location specifier to indicate the array should be located in program memory. For example:

int code arrayOfPrimes[3] = {2, 3, 5};
I can also use the '_at_' specifier to locate an array at an absolute memory address. For example:
int arrayOfPrimes[3] _at_ 0x80;
arrayOfPrimes[0] = 2;
arrayOfPrimes[1] = 3;
arrayOfPrimes[2] = 5;
However, I can't use both specifiers together in any meaningful way. This is because locating an array in code space requires that I initialize the array as I declare it (I can't change it in the program because it is in ROM). However, I can't initialize the array because the '_at_' specifier doesn't allow it for some reason. Thus:
/* This won't work! */
int code arrayOfPrimes[3] _at_ 0x80 = {2, 3, 5};
/* This works but is meaningless because I can't initialize the array. */
int code arrayOfPrimes[3] _at_ 0x80;
Any suggestions on how to get around this?


More questions in this forum