Improve Nvmc implementation of embedded-storage traits #374
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR opens a design discussion regarding the Nvmc API and implementation.
It contains the following 3 commits:
new
doesn't check that the storage is well-aligned.read
confuses offsets in the storage and offsets in the output buffer.read
output buffer is word-aligned.read
reads big-endian words regardless of the architecture.erase
doesn't check that the input is within bounds.erase
divides by 4 twice (other time is inerase_page
).write
doesn't check that the input is within bounds.write
confuses offsets in the storage and offsets in the input buffer.write
writes big-endian words regardless of the architecture.read
is very complicated and seems to have other bugs.READ_SIZE
is 4 instead of 1, which is unnecessarily constraining (at least for nRF52840).[u32]
instead of[u8]
, which optimizes for writes instead of reads.READ_SIZE
from 4 to 1 and addsNvmcError::OutOfBounds
. But those changes seem needed.