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.

CC2510 Flash Lock Problem

Hello Support,

I have an application that works as expected when flash protection is disabled. However, when I set flash to lock, the application fails. Any ideas what would cause this? BTW, I'm reading and writing to flash memory during runtime (EEPROM emulation technique). Would this cause the failure?

Thanks for the help,

Chris

  • If you try to write to the flash pages that are protected, programming will not succeed. This is likely what's causing the failure you're seeing.

    Only to lock the flash pages that you really need to (e.g. where your application code resides) and keep the other pages unlocked so that you can use that part of the flash for storage.

  • Makes sense... thanks.

    As it is now, the application code resides at the beginning and the writable flash is behind it. It appears that the lock option only allows locking in the direction of memory end to beginning (page x - 31). If this is so, then I need to place the writable memory at the beginning and the application code following after. If this is correct, how do I code the memory mapping?

    Thanks for the help.

  • You're right. With the flash lock bits, you start locking the pages from the end of the flash. The exception is the BBLOCK bit, which can be set independently of the other lock bits and will lock the first 1kB flash page (starting at address 0).

    So if locking the "boot block" is not sufficient, you can move the code as you suggest. The best way to do this is by manipulating the linker file a bit. Since the interrupt vectors have to be located in the flash page 0 (first flash block, also called the boot block), you can for instance place your NVRAM area starting at page 1 and place your code at page 8 and higher.

    Modify the the linker file (lnk51ew_cc2510F32.xcl) as suggested below:

    Change start address for the code: -D_CODE0_START=0x002000

    The line -Z(CODE)INTVEC=0 will still make sure the interrupt vectors are placed correctly.

    You could also specify an NVRAM area:

    -D_NVRAM0_START=0x000400
    -D_NVRAM0_END=0x001FFF
    -Z(CODE)NVRAM=_NVRAM0_START-_NVRAM0_END

    This allows you to use placement directives in your code, for instance

    #pragma location="NVRAM"
    #pragma data_alignment=2
    __no_init const myConfigParameters_t configParams;
    
    
    This makes it very easy to access and program specific parts of your NVRAM.