This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Where does FDS write the data to?

Hi,

    I checked the flash_fds example. I could not tell the address it tries to access to. Is there any way I can find the address? Can I limited it to a certain address range? What is the data structure looks like?

Thank you,

Min-Ching

  • Hi Håkon,

         The link you provided is for 52832 and we are using 52840. The flash size is a lot different in between these two. In the link, it says the end of the flash address is 0x80000 which is only half way of the flash on 52840.

          I tried to find "fstorage_internal_defs.h" in the SDK14.2. I can not find this file at all. I also tried to find "fs_flash_page_end_addr" function in the SDK14.2. I still can not find it. The closest one I found is fds_internal_defs.h. But, I can not see the end of address there. Can you please help me to identify where the address is? 

         One very important question we need to know. We will have some partitions on the internal flash. Each partition will have it's purpose. Will SoftDevice try to read or write data on internal flash? If it does, where does it stores the data? We want to avoid overlapping partitions. 

     

    Thank you,

    Min-Ching

  • I think you're mixing between the functionality provided in FDS and the FSTORAGE library.

    The Fstorage library is a driver for flash storage, with support for SoftDevice and NVMC backend.

    Fstorage has a simplistic API, where the application controls which address/page of the flash is manipulated.

    FDS is a filesystem implemented on-top of fstorage, where each entry is tagged in a type/length/value (TLV) structure, where the user sets aside a given amount of flash pages (min. 2, because one page will be tagged as SWAP). The amount of pages set aside is configurable in your project's define sdk_config.h::FDS_VIRTUAL_PAGES.

    FDS is used by the peer_manager library, which handles storing of bluetooth bonds to flash.

    When using FDS, the pages are located from the top of flash (derived from values in FICR), or from the DFU/Bootloaders area and down if a bootloader is present in your device.

    This is shown better in fds.c::flash_end_addr():

    static uint32_t flash_end_addr(void)
    {
        uint32_t const bootloader_addr = NRF_UICR->NRFFW[0];
        uint32_t const page_sz         = NRF_FICR->CODEPAGESIZE;
    #ifndef NRF52810_XXAA
        uint32_t const code_sz         = NRF_FICR->CODESIZE;
    #else
        // Number of flash pages, necessary to emulate the NRF52810 on NRF52832.
        uint32_t const code_sz         = 48;
    #endif
    
        return (bootloader_addr != 0xFFFFFFFF) ? bootloader_addr : (code_sz * page_sz);
    }

    Cheers,

    Håkon

Related