Closed ia0 closed 2 years ago
This PR looks pretty good to me! Solves some real problems the API currently has and I would love to see it merged
This looks good, thank you!
bors r+
Since some of these bugs made Nvmc pretty much impossible to use, are you planning to make a new release with these changes?
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.