[riot-notifications] [RIOT-OS/RIOT] sam0_common/periph/flashpage: fix unaligned write (#15707)
notifications at github.com
Tue Jan 5 13:39:28 CET 2021
### Contribution description
- add test of unaligned write to tests/periph_flashpage (sam0 only section regarding user page)
- fix unaligned write for sam0_common/periph/flashpage implementation
The previous implementation did not allow data sizes of < 3 bytes to be written.
The casts within the code could also lead to unaligned `uint32_t` pointers.
An underflow of the `len` variable was previously possible.
### Testing procedure
The first commit which modifies the test in tests/periph_flashpage should break the test "test_config_page" which is available on sam0 devices with a user page only. The test should hardfault at cpu/sam0_common/periph/flashpage.c:234.
The test will run successfully after applying the second commit.
### Issues/PRs references
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* tests/periph_flashpage: test unaligned write for sam0
* cpu/sam0_common/periph/flashpage: fix unaligned writes
-- File Changes --
M cpu/sam0_common/periph/flashpage.c (39)
M tests/periph_flashpage/main.c (62)
-- Patch Links --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications