Tool/software: TI C/C++ Compiler
Hi.
I'm currently developing a ZStack application. How can I store a constant variable (an array of uint8) in a program (flash) memory and read it's value?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
Hi.
I'm currently developing a ZStack application. How can I store a constant variable (an array of uint8) in a program (flash) memory and read it's value?
osal_nv_write and osal_nv_read store data in EEPROM, I meant to ask how to store data in code memory.
In c/c++ reference I've found __code attribute.
Will it be correct and safe to declare variable like this to store constant data in code memory?
__code const unsigned char test[] = {0x00, 0x01, ...};
hold li said:You must define your variable with __root keyword,IAR will not "store" your variable to RAM but to flash,don't need osal_NV_write and osal_NV_read.
please search "IAR __root" keyword in google,you can get vary much result.
Thanks for reply. Using __code attrubute solved my problem. __code attribute tells compiler to store variable in code memory.