[riot-notifications] [RIOT-OS/RIOT] sam0_common/periph/flashpage: fix unaligned write (#15707)

DanielLockau-MLPA 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

None
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/15707

-- 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 --

https://github.com/RIOT-OS/RIOT/pull/15707.patch
https://github.com/RIOT-OS/RIOT/pull/15707.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15707
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210105/aa5e4e9e/attachment.htm>


More information about the notifications mailing list