-
Notifications
You must be signed in to change notification settings - Fork 6
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
Erasing all items #47
Comments
Ah yeah, I feel like this can be done! Should be the same as the current remove function but without the key check. Good idea! I think I can work on this a bit later this week. But feel free to drop a PR if you feel sufficiently self-nerd-sniped :P |
I'll take a look at implementing this over the next day or two and submit a PR :) |
Shouldn't it use its own "overwriting" key-invalidation mechanism instead? I feel like it should only ever need to page-erase when running out of space during store. |
Yes, that's what the remove function does. It 'erases' the items by setting the CRC field to 0. No actual erases are done. |
Currently, there's a
remove_item()
API, but there's no way to clear out the entire flash buffer without worrying about the key.One can do this by erasing the whole range that was given to
sequential-storage
blindly, but this is often overkill and can be much more flash than actually needs erasing, which can result in unnecessarily long erase times.As an example, in Stabilizer, we use the second flash bank (1MB) to store our settings, but the settngs themselves are less than a handful of bytes each. The resulting bank erase takes several seconds (~10 or so), when in reality it could likely be done much more quickly.
It seems like it would be a desirable to have a function like
remove_all_items(f: &mut Flash, range: Range<u32>)
that scans through the range for all sequential-storage items and erases only the flash memory that contains sequential-storage items.Thoughts?
This came up in quartiq/stabilizer#884 (comment) while discussing a firmware change for reference.
The text was updated successfully, but these errors were encountered: