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.

CC2530: Store constant array in internal-Flash

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK

Hi guys,

I want to store one array in CC2530's internal-flash. I'm working with IAR to program for cc2530-f256. These are what I have done:

  • Declare the array as following:

#pragma location = "TEST_ROM"

__xdata_rom const uint8_t my_array[10] = {1,2,3,4,5,6,7,8,9,10};

  • Edit lnk51ew_cc2530F256_banked.xcl - the linker file:
    • Add this line in XDATA section:

-Z(CODE)TEST_ROM=0x8000-0xFFFF ( I tried entering other address range but nothing change).

  • Change project options:
    • General options/ Code Model: Banked
    • Linker/Output/Format: I choose "debug information for C-SPY".

There is no error or warning at all. But when I try to get each member's value in the array, the return value is wrong compared to the init values. I stored one variable in internal-Flash and every thing seems to be ok when I want to use that variable's value.

When I check the map output, it indicates that there are 10 bytes stored in TEST_ROM section. But when I try to get each member's value in the array, the return value is wrong compared to the init values. I try storing one variable in internal-Flash and every thing seems to be ok when I want to use that variable's value.

If anyone knows how to fix this issue, please share so I can fix it.

Thanks and Best regards.