Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cfg_page: provide/manage of configuration variables in flash #17092

Closed
wants to merge 43 commits into from

Conversation

mcr
Copy link
Contributor

@mcr mcr commented Nov 1, 2021

Contribution description

cfg_page is a driver that provides for an interface to store key/value pairs in flash.
It supports continuous updating of variables (such as is required for RPL lollipop counters). This is flash write efficient, and it does not overwrite flash, but rather appends to it in a log-like fashion. The last value is returned.

The keys and values are stored in CBOR format, with a 16-byte header that has a CRC and a revision.
Two "SECTOR"s are needed: when one is full the latest values are copied to the other page and that page is activated.

It is disappointing that the NAND flash interface provided by mtd* means that it is necessary to allocate RAM to read the variables in, and worse, causes the need for a second (4K) page when copying.
There are many opportunities for optimization: at this point many might be premature.

Testing procedure

The driver program tests/drivers_cfg_page is provided.
It uses the mtd_native interface to do testing on a host platform.
The testing process is to write three variables 256 times, and then print the results.

Issues/PRs references

None, but clarifications to mtd interface is desired.

mcr added 30 commits October 29, 2021 18:07
added cfg_page_print
added cfg_page_init_reader
…n correctly back up one byte before writing.
…slot swap, just allow the writer to loop once
…where the header gets initialized so that a single writer is used
@github-actions github-actions bot added Area: boards Area: Board ports Area: doc Area: Documentation Area: drivers Area: Device drivers Area: examples Area: Example Applications Area: Kconfig Area: Kconfig integration Area: tests Area: tests and testing framework Platform: native Platform: This PR/issue effects the native platform labels Nov 1, 2021
@miri64 miri64 changed the title provide/manage of configuration variables in flash cfg_page: provide/manage of configuration variables in flash Nov 1, 2021
@miri64 miri64 added the Type: new feature The issue requests / The PR implemements a new feature for RIOT label Nov 1, 2021
@benpicco benpicco requested a review from bergzand November 1, 2021 20:04
@PeterKietzmann PeterKietzmann mentioned this pull request Nov 16, 2021
@stale
Copy link

stale bot commented Jun 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Jun 12, 2022
@stale stale bot closed this Aug 13, 2022
@chrysn
Copy link
Member

chrysn commented Sep 19, 2022

This (or an updated version) should work well on top of #18608

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: doc Area: Documentation Area: drivers Area: Device drivers Area: examples Area: Example Applications Area: Kconfig Area: Kconfig integration Area: tests Area: tests and testing framework Platform: native Platform: This PR/issue effects the native platform State: stale State: The issue / PR has no activity for >185 days Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants