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

‘Application data’ placement in the flash memory

Questions about ‘Application data’ placement in the flash memory

Is there a function or other mean that could give me what is the lowest flash memory address that is occupied from the Application Data?

Is the Application data size formed only by FDS_VIRTUAL_PAGE_SIZE, FDS_VIRTUAL_PAGES, FDS_VIRTUAL_PAGES_RESERVED?

If I define some number of FDS_VIRTUAL_PAGES_RESERVED – where they will be placed – on top of FDS_VIRTUAL_PAGES (bigger address number than address for FDS_VIRTUAL_PAGES)  or at the bottom?

 nrf_fstorage_erase() function has a parameter ‘address of the flash pages to erase’, - what address is this – start address (lower addr number) or end address (max occupied address)?

nrf_fstorage_write() and nrf_fstorage_read() functions parameter for address – can I use any number from the start of the page or have to be offset X*4bytes from the start page address, or any other restriction?

Thanks

Parents
  • Hi,

    Is there a function or other mean that could give me what is the lowest flash memory address that is occupied from the Application Data?

     You may refer to the flash_bounds_set() function in fds.c, but note that this function is not exposed to the application. 

    Is the Application data size formed only by FDS_VIRTUAL_PAGE_SIZE, FDS_VIRTUAL_PAGES, FDS_VIRTUAL_PAGES_RESERVED?

     Yes, correct.

    If I define some number of FDS_VIRTUAL_PAGES_RESERVED – where they will be placed – on top of FDS_VIRTUAL_PAGES (bigger address number than address for FDS_VIRTUAL_PAGES)  or at the bottom?

     Yes, the reserved pages will be placed starting from the top.

     nrf_fstorage_erase() function has a parameter ‘address of the flash pages to erase’, - what address is this – start address (lower addr number) or end address (max occupied address)?

     It takes the start address of the page you want to erase. 0x0, 0x1000, 0x2000 and so on. If you pass it lets say address 0x1000, it will erase everything from 0x1000 to 0x1FFF. 

    nrf_fstorage_write() and nrf_fstorage_read() functions parameter for address – can I use any number from the start of the page or have to be offset X*4bytes from the start page address, or any other restriction?

     Yes. But make sure to now write anything into the FDS area as that may corrupt the filesystem. Use the FDS APIs when you want to store or access data in fds. 

  • Hi Vidar,

    Thanks for quick respond!

    I'll explore 3 scenarios to save my simple uint32 number in the flash: 1. Beneath FDS memory area, 2. define 1 FDS_VIRTUAL_PAGES_RESERVED and place my uint32 there, 3. use FDS

    BTW do you know if I define 1 FDS_VIRTUAL_PAGES_RESERVED, what will  fds_stat include in the report -  only   FDS_VIRTUAL_PAGES or FDS_VIRTUAL_PAGES + FDS_VIRTUAL_PAGES_RESERVED ?

    Regards

  • Hi,

    No problem. FDS stat will only return information about the FDS filesystem. It does not care about what you have stored in the reserved pages.

Reply Children
No Data
Related