We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi Guys
How am i able to assign values to a variable i have stored in flash so that it is included in the hex file?
For example: i have declared a variable volatile unsigned char code err_msgs[10][20] _at_ FLASHSTART;
but cannot assign an initial value to it and have to write it's value to flash when my program starts.
Xarion
yeah i can just strcpy into the array at runtime but thats going to use more code to write each character to flash as to write to flash its not just assigning to a variable, i'm running tight with space which is my real aim in doing this.
"yeah i can just strcpy into the array at runtime"
No, you can not!
You not only need a 'C' textbook, but also an 8051 textbook!
As far as 'C' is concerned, you cannot write to a const object;
As far as the 8051 is concerned, you cannot write to CODE space.
You need to initialise the array in its definition - in the same way that you can initialise any other 'C' array in its definition...