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

Managing multiple files with significant difference is size, using FDS module

I will want to have multiple files in my application, so I will use multiple file IDs when writing records.

At a minimum, I will want one file which will store about 200 bytes worth of raw configuration data.  The second file will be used as a event log; I will want to store at least 1024 events, where each event is 16 bytes.

For the configuration data, I would use one record key and update the record when changes need to be made.

For the event data, I would start with a record key of 1, and increment the key every time a new event is logged.  When required, I would open the file with records (events) and send them the raw data of each record back to the client.  After 1024 records are recorded, I would want the 1025th record to overwrite the 1st record (but the record ID would continue to increment).

In all, I would want File 1 to be ~214 bytes in size, and I would want File 2 to be ~16KB in size. 

Would this mean I would want FDS_VIRTUAL_PAGE_SIZE to be 20KB, and I would have to set FDS_VIRTUAL_PAGES to 2, therefore allocating 40KB of flash for FDS?

Is there a better way to do this?  My other thought was using the Flash Storage module and writing a driver to handle raw flash transactions to handle event data.

Related