Loading and saving structs to flash every reboot - use nvs, wl, or fat API?
Posted: Sun Nov 14, 2021 6:20 pm
I'm loading and saving two structs from/to flash each boot. This will quickly add up to > 10k saves, so I need to implement some kind of wear management. I'm not sure what the best option is. I don't want to add extra power-consuming overhead, so I'm leaning toward lower-level operations. But I'm not sure what's supported by which library.
Option 1: Use nvs_set_blob, but change the key every 10k saves. Is this even guaranteed to move the write to a new sector?
Option 2: Use wl_mount, wl_write. Seems straightforward, but I'm lacking examples. Are there any examples out there of using this technique? I'm not sure how the partitions work, and how to ensure the wl is actually working.
Option 3: Use FATfs. This seems to be a lot of overhead, and I'd have to transfer from file to struct and back. I'd rather just write the struct bytes. But maybe this is the only option?
Questions: which options can be made to work? Are there any examples out there of using option #1 or #2?
Thanks in advance for any and all help!
Option 1: Use nvs_set_blob, but change the key every 10k saves. Is this even guaranteed to move the write to a new sector?
Option 2: Use wl_mount, wl_write. Seems straightforward, but I'm lacking examples. Are there any examples out there of using this technique? I'm not sure how the partitions work, and how to ensure the wl is actually working.
Option 3: Use FATfs. This seems to be a lot of overhead, and I'd have to transfer from file to struct and back. I'd rather just write the struct bytes. But maybe this is the only option?
Questions: which options can be made to work? Are there any examples out there of using option #1 or #2?
Thanks in advance for any and all help!