This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

assign value to flash memory

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

Parents Reply Children
  • "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...