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.

BLE Stack - User application needs 64KB NV data - How?



My user application needs to use 64KB of NV and I would like to know a safe way to implement it. 

Is it best to increase HAL_NV_PAGE_CNT and use that space or should I just create a static stucture and use it that way.

I do need to have XLink CRC the code at link time so it can be verified at boot time (so the static structure may be an issue).

(this is a write once data structure so I don't have to be concerned about the flash erase timing issue impacting my BLE communication)

tks.

  • NV is continually changing as its items are updated, so it would not be appropriate to be part of a CRC.

    All constants in the program must fit within one bank (16 pages, or 32KB), so this is not an option.

    Thus, you are only left with declaring a huge __code uint8 data[] = {, with a #pragma to place it correctly and an entry in the linker file for that reserved area. You will access the data at run-time with HalFlashRead().

  •  

    In an attempt to get this space allocated, I have tried the following code in a c file:


    #define NV_SIZE 4096
    const uint8 my_data[NV_SIZE] @ "BANK5";

     This looks like it compiles correctly, providing the following listing output:

            RSEG BANK5:CONST:REORDER:NOROOT(0)
            DATA8
    //   54 const uint8 my_data[NV_SIZE] @ "BANK5";
    my_data:
            DB 0, 0, 0, 0, 0, 0, 0, 0
            DB 0, 0, 0, 0, 0, 0, 0, 0

     But there is no trace of this in the map file and the space gets filled as if this array was not there.  Am I missing something?

     

     

     

     

  • Your missing 'required'. Also, I would recommend using the deterministic memory placement shown by several examples of the sample apps, take the snippet from osal_snv.c:

    #pragma location="CRC_SHDW"
    const CODE uint16 _crcShdw = 0xFFFF;
    #pragma required=_crcShdw

    So in the linker file, there is an exact memory area defined for CRC_SHDW

  • That did it!

    tks!