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.

How to create a custom data space in CC2530 flash.

Other Parts Discussed in Thread: CC2530

Hi all ,

I am  using the cc2530 with 256k flash and zstack. I trying to reserve a 2k memory area

that will not be erased when you reflash new firmware in order to store some callibration

values. I am trying to create something like my own Info page that can also be written on runtime.

As my first attempt I tried to reserve some memory using the linker script (f8w2530.xcl) by reserving

a small area (12 bytes) 

-D_BD_TEST_START=(_IMPLICIT_CERTIFICATE_ADDRESS_SPACE_START-0xC)

-D_BD_TEST_END=(_BD_TEST_START+0xB)

-Z(CODE)BD_TEST_ADDRESS_SPACE=_BD_TEST_START-_BD_TEST_END

and then initializing a variable in onboard.c 

#pragma location="BD_TEST_ADDRESS_SPACE"

__no_init uint8  _bdtest[12]; 

#pragma required=_bdtest

This works but when I change the value at runtime and reflash new firmware 

the content of my reserved area does not retain the value (it becomes 0xFF)

How is it possible to create a 2k block (like the info page) that is retained after

I erase the flash?

Is there  a special area that I should put it in the linker script (Maybe below the info page) ?  

 

thank you in advance,

georgios panagakis

  • Good attempt.

    Leaving the page that you want to use in the memory map gives IAR license to fill it with 0xFF's, even though you use this: __no_init

    So, the solution is to take the pages that you want to use for custom data out of the memory map altogether. I attach a small example of this with a linker file based on the default linker file and a GenericApp.c sample app based on the default sample application from ZStack 2.5.0 installer. I have only modified the ZC build target.

    Study the example by using a diff tool.

    Note how with the new project options debugger setting to "Preserve unused", changing something, re-compiling, and loading and debugging via IAR leaves the custom data area untouched.

    If you had to do production "re-programming", you would have to use the command line interface of the SmartRF Programmer tool to read out the .hex file, super-impose the custom data pages on the new .hex image to program, and erase/program/verify it (no, the append/verify does not work, I already tried it - it doesn't erase the pages with custom data, but it doesn't program the new image correctly either, because it doesn't erase anything.)

    More likely in the field you would boot load an updated image, so you would have to modify the boot loader example code to "skip" these custom data pages during the boot load.

     

     

    GenericAppDemoCustomData.zip
  • Hi all,

    i have a question concerning the internal flash memory of a cc2530. Is there a possibility to write one or two pages without recompiling the whole software? in my application, i want to save node specific data (like a specific node id and calibration data) into the flash of multiple nodes without having to recompile the whole firmware after changing those parameters. I could not find a tool to do that yet.

    As you mentioned, I can read out the memory into a hex file, modify it and re-flash it into the chip. Can you give me a hint, where to find the values stored in page 14 or 15 (as far as I understand, those should be the last pages in bank 1, right?).

    additionally, I don't want those data to be erased/overwritten when the firmware is updated.

    thanks for your time and help!