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

Application data and peer manager with FDS

I have an application that uses FDS and I've recently added to it the peer manager in SDK 12.2.0, which also uses FDS. It turns out that the application data keeps being updated, so every time that happens, a record is deleted in FDS and a new one is allocated and flash pages can't be reused until all their records have been deleted. I managed not running out of flash by adding an extra flash page to FDS so there's always one that can be reused by the garbage collector. Pages sort of keep rolling and each time a new one is used, the oldest one gets freed.

My concern here is that if application data and peer manager share the same FDS space. If I pair a device (let's say I allow pairing only once), then I'll have at least one page that will hold the pairing information and that I'll never be able to reuse. Is that correct?

Also, my application stores a given number of records in FDS. Each record always has exactly the same size and it's only their contents that change. Is it possible to reuse exactly the same flash section, taking into account data size never changes? That way I wouldn't need to worry about reusing flash pages and assigning that extra page to FDS.

  • Hi Genis,

    What exactly you meant by "I'll have at least one page that will hold the pairing information and that I'll never be able to reuse" ?

    There is no page dedicated for peer manager or any module. The record is stored and rotated around multiple pages when we do deleting and updating records. Records from different module can be stored on same flash page.

    When you want to change the content of a record, it's not possible to simply overwrite the record in the flash. You need to erase the whole flash page to be able to update a value inside that page. We avoid doing that by simply mark the record as deleted and find a new place to write the new value.

    When you determine FDS size, always give one extra page for garbage collection.

Related