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};
int arrayOfPrimes[3] _at_ 0x80; arrayOfPrimes[0] = 2; arrayOfPrimes[1] = 3; arrayOfPrimes[2] = 5;
/* 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;
Use the Search (look left) - this has been discussed many times before!
Take a look at: http://www.keil.com/support/docs/130.htm Jon
Hmm... I did try searching before hand, but didn't come up with anything. Another post points to how to do this using the linker. I saw this in the manual, but I was trying to avoid coding on the linker level. Thanks for the pointer. josh
Jon, I think you should include that one in your Top Ten Q&A http://www.keil.com/support/topten.asp
Why do you need to avoid Linker options? The altetnative is to do it in Assembler.
The top-ten list is updated every day. It is automatically generated based on which ones are used most frequently in a 3-month period to answer technical questions. Jon