-
Notifications
You must be signed in to change notification settings - Fork 7.6k
nvs: also support sector_size of 64KB #91389
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
base: main
Are you sure you want to change the base?
Conversation
Hi @mjchen0, the limitation of NVS to smaller sector sizes is an internal property. The proposed change does not enable the use of larger sectors. |
Sorry, my title wasn't correct (I've changed it). I wasn't trying to support arbitrarily large sectors. I was just trying to make NVS work with FLASH that has only 64KB erase units. NVS seems to have a max sector size of 64KB. It's not described in the documentation of nvs.rts, but appears due to the representation of address as described in nvs_priv.h:
With 16-bits for offset, a 64KB sector size is possible (offset 0 to 0xffff) except that the sector_size field itself is uint16_t so 64KB couldn't be stored as the size. |
Ok, makes sense. Could you extend the PR with a check that sector_size is <= 64kB ? Also change the title to reflect "<=64kB". |
3a7f692
to
4734e23
Compare
I added the test in nvs_mount() that the sector_size isn't greater than 64KB. I also added a new test case for native_sim with 64KB erase blocks, and a test that the nvs_mount() returns the expected error for a bad sector_size value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
4734e23
to
8b325ed
Compare
Allows NVS to work with flash device configured to use only 64KB block erase. Due to how addresses are encoded internally in NVS, 64KB is the maximum sector size. Add a test for this during mount. Add a native_sim unit test case for 64kb erase block size Signed-off-by: Mike J. Chen <mjchen@google.com>
8b325ed
to
9ab7231
Compare
|
Allows NVS to work with flash device configured to use only 64KB block erase.