-
Notifications
You must be signed in to change notification settings - Fork 2k
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
pkg/{littlefs,littlefs2}: fix unaligned memory accesses #18473
Conversation
Previously `tests/pkg_littlefs` crashed on the `samr21-xpro`. This now aligns the buffers in `littlefs_desc_t` to the alignment requirement of `uint32_t`. Specifically the issue causing the crash at hand was that `lfs_free_t::buffer` is of type `uint32_t *`, so access are expected to be aligned to `uint32_t`. After this commit, this assumption is fulfilled.
Previously `tests/pkg_littlefs2` crashed on the `samr21-xpro`. This now aligns the buffers in `littlefs2_desc_t` to the alignment requirement of `uint32_t`. Specifically the issue causing the crash at hand was that `struct lfs_free::buffer` is of type `uint32_t *`, so access are expected to be aligned to `uint32_t`. After this commit, this assumption is fulfilled.
If it's an unaligned access, does it read/write whole words (or u16/u32)? In that case, wouldn't also a proper multiple be required, and thus probably a word (or u16/u32) typed buffer? |
Anyhow, nice catch! |
The Likely it is worth to use just |
The sole failure is a CI glitch:
|
Darn. Ya, if someone who knows make better than me wants to take a look at #18470 we can fix those glitches. I want to just silence those commands but still fetch the package. |
Contribution description
This aligns the buffers in
littlefs_desc_t
/littlefs2_desc_t
to fix hard faults on Cortex M0+ MCUs such as thesamr21-xpro
.Testing procedure
make BOARD=samr21-xpro -C tests/pkg_littlefs
make BOARD=samr21-xpro -C tests/pkg_littlefs2
Issues/PRs references
Prior to #18141 the alignment requirement was met but luck. With this, the alignment requirement is now communicated to the compiler, which should fix future issues.