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.

CC2541 flash storage - xcl file modification

Hi,

I'm trying to implement very basic 'file system' to store large amount of data.

How can I 'set aside' 100kb of flash space (50 pages) to be accessed through hal_flash read/write functions ?

What are the required modifications to the xcl/linker settings ?

Thanks

  • Hello.  Essentially, you'll need to shrink the space allocated for code and then allocate this space for your own use. So you'd start by creating your own address space, similar to what is done for BLE_NV_ADDRESS_SPACE:

    // Internal flash used for NV address space.
    // Address range for HAL_FLASH_PAGE_SIZE == 2048
    -D_BLENV_ADDRESS_SPACE_START=0x7E800
    -D_BLENV_ADDRESS_SPACE_END=0x7F7FF
    -Z(CODE)BLENV_ADDRESS_SPACE=_BLENV_ADDRESS_SPACE_START-_BLENV_ADDRESS_SPACE_END

    You'll then need to modify the code banks since there is less code available. You'll need to do this in the "Setup of Code Banks" section. You can find an example of this in the linker files used for the OAD image A/B.

  • Thanks Tim for your answer..

    So to see if I got it right -

    in the xcl file I should add the following lines:

    -D_MY_RESERVED_SPACE_START=0x40000
    -D_MY_RESERVED_SPACE_END=0x77FFF // total of 32+32+32+16 = 112 KBytes
    
    Z(CODE)MY_RESERVED_ADDRESS_SPACE=_MY_RESERVED_SPACE_START- _MY_RESERVED_SPACE_END // or should it be declared as Z(XDATA) or other ??

    Then I should modify the following on the 'Setup of code banks' section :

    // -P(CODE)BANK4=_BANK4_START-_BANK4_END  // Taken by MY_RESERVED_SPACE
    // -P(CODE)BANK5=_BANK5_START-_BANK5_END  // Taken by MY_RESERVED_SPACE
    // -P(CODE)BANK6=_BANK6_START-_BANK6_END  // Taken by MY_RESERVED_SPACE
    -D_BANK7_START= 0x78000  // Modified code Bank 7 start address. Was 0x70000
    -P(CODE)BANK7=_BANK7_START-_BANK7_END  // Partially Taken by MY_RESERVED_SPACE

    Did I get you correctly ?

    Thanks again