Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problem with fstorage changes in SDK v14

I'm migrating an existing application from SDK v13 to SDK v15 and have run into a minor issue with the fstorage changes introduced in SDK v14.

My application uses both fds and fstorage libraries. In v13, this worked because fstorage figured out for itself where to locate FDS and my own flash areas. In v14, one is required to specify flash start/end addresses in nrf_fstorage_t which would logically be just below the area used by FDS, but there is no way to determine which memory is used by fds.

The obvious solution is an FDS api which returns the starting address of flash used by FDS (m_fs.start_addr). I can implement this myself by hacking fds, but want to bring this to the attention of the Nordic developers in the context of the Mesh SDK which is completely missing the functionality previously provided by fstorage (this thread).

Succinctly, concurrent use of fds and fstorage is a common use case for which we need appropriate api's.

Thanks,
Richard

Parents
  • Hi,

    The FDS area is quite simple to figure out from the application. The parameters to fstorage is set in fds_init, using the following functions:

    static uint32_t flash_end_addr()
    {
        uint32_t const bootloader_addr = NRF_UICR->NRFFW[0];
        uint32_t const page_sz         = NRF_FICR->CODEPAGESIZE;
        uint32_t const code_sz         = NRF_FICR->CODESIZE;
    
        return (bootloader_addr != 0xFFFFFFFF) ? bootloader_addr : (code_sz * page_sz);
    }
    
    
    static void flash_bounds_set(void)
    {
        uint32_t flash_size  = (FDS_PHY_PAGES * FDS_PHY_PAGE_SIZE * sizeof(uint32_t));
        m_fs.end_addr   = flash_end_addr();
        m_fs.start_addr = m_fs.end_addr - flash_size;
    }

    Best regards,
    Jørgen

Reply
  • Hi,

    The FDS area is quite simple to figure out from the application. The parameters to fstorage is set in fds_init, using the following functions:

    static uint32_t flash_end_addr()
    {
        uint32_t const bootloader_addr = NRF_UICR->NRFFW[0];
        uint32_t const page_sz         = NRF_FICR->CODEPAGESIZE;
        uint32_t const code_sz         = NRF_FICR->CODESIZE;
    
        return (bootloader_addr != 0xFFFFFFFF) ? bootloader_addr : (code_sz * page_sz);
    }
    
    
    static void flash_bounds_set(void)
    {
        uint32_t flash_size  = (FDS_PHY_PAGES * FDS_PHY_PAGE_SIZE * sizeof(uint32_t));
        m_fs.end_addr   = flash_end_addr();
        m_fs.start_addr = m_fs.end_addr - flash_size;
    }

    Best regards,
    Jørgen

Children
Related