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

What is the proper procedure to re-establish Flash Data Storage when a new version of the application changes size

If I have a version 1.00 of my application which stores data in using flash data services .
I make modification and version 2.00 of my application is a page larger.

1A) If I allow the default of 3 pages, will the old FDS records be available ?

1B) If I have changed the number of pages to maximize usage by FDS in version 1.00 what do I need to do in version 2.00 to clean up the old files/records?

Then I have found a way to reduce my application size for version 3.00 to be 1 page less than version 2.00 most recently run.

1A) If I allow the default of 3 pages, will the old FDS records be available ?

1B) If I have changed the number of pages to maximize usage by FDS in. version 1.00 what do I need to do in version 2.00 to clean up the old files/records?

  • Hi,

    If I have a version 1.00 of my application which stores data in using flash data services .
    I make modification and version 2.00 of my application is a page larger.

    1A) If I allow the default of 3 pages, will the old FDS records be available ?

    All the old FDS records will still be available if the new application reserves the same number or a higher number of FDS pages. If by the application being a page larger you implicitly mean that the number of FDS pages is one page lower, then you risk loosing data.

    1B) If I have changed the number of pages to maximize usage by FDS in version 1.00 what do I need to do in version 2.00 to clean up the old files/records?

    There is no out of the box support for shrinking the FDS area. Over time, FDS will store records in a non-predictable pattern so you cannot know without examining a specific device how data is organized, including which pages are data pages and which page is the swap page. If the amount of FDS data is so high that it cannot fit in the number of data pages (1 less than total page count), then you will loose data. If you have at least one page free, then you can do garbage collection first to clean-up. However, the swap page can be any page still. So you would probably also need to copy a potential data page at a lower address upwards, so that all data pages are within the new FDS region. And you would need to perform a page erase on the page that will become a swap page. This is not supported by the FDS library, and would have to be done before you update to your larger application. Perhaps using an intermediate application so that it will not bee too large.

    Then I have found a way to reduce my application size for version 3.00 to be 1 page less than version 2.00 most recently run.

    1A) If I allow the default of 3 pages, will the old FDS records be available ?

    Increasing the number of FDS pages is no problem. Say you have 2 pages (1 data and 1 swap) and want to add on one more. Then you increase the configured number of pages and ensure that the new page is fully erased. In that case, FDS will initialize it as a new page. The old data page will still be intact and you will not have lost any data.

    So, to sum up: Adding additional FDS pages is no problem, just ensure that the new page is fully erased before initializing FDS. Reducing the number of FDS pages without data loss is not supported out of the box. If there is enough free space, then it would be possible, but the implementation details are up to you.

Related