drivers/flash: stm32g0: Prepare for unaligned accesses in flash writes
When using the settings subsystem, the data argument argument passed to
flash_stm32_write_range() might not be 8-bytes aligned, causing an
unaligned memory access fault.
Fix that the same way as it was done for the STM32L4 in commit
652efa530f
.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
dada9ea54b
commit
2ea4516a4a
1 changed files with 2 additions and 1 deletions
|
@ -194,7 +194,8 @@ int flash_stm32_write_range(const struct device *dev, unsigned int offset,
|
|||
int i, rc = 0;
|
||||
|
||||
for (i = 0; i < len; i += 8, offset += 8) {
|
||||
rc = write_dword(dev, offset, ((const uint64_t *) data)[i>>3]);
|
||||
rc = write_dword(dev, offset,
|
||||
UNALIGNED_GET((const uint64_t *) data + (i >> 3)));
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue