drivers: flash: stm32h7x: Fix wrong flash write offset
The flash_stm32_write_range() function of the STM32H7x flash driver partially uses a wrong flash program word size for certain SOC types when calculating the flash write offset. If the used SOC is not having a flash program word size of 256 bits / 32 bytes the written data might get corrupted, as the flash write offset value does not match the number of bytes that were actually written. Fixes #45568 Signed-off-by: Christoph Heller <chris@metanetics.de>
This commit is contained in:
parent
12532ee13d
commit
382ee011d5
1 changed files with 1 additions and 1 deletions
|
@ -373,7 +373,7 @@ int flash_stm32_write_range(const struct device *dev, unsigned int offset,
|
|||
const uint8_t nbytes = FLASH_NB_32BITWORD_IN_FLASHWORD * 4;
|
||||
uint8_t unaligned_datas[nbytes];
|
||||
|
||||
for (i = 0; i < len && i + 32 <= len; i += 32, offset += 32U) {
|
||||
for (i = 0; i < len && i + nbytes <= len; i += nbytes, offset += nbytes) {
|
||||
rc = write_ndwords(dev, offset,
|
||||
(const uint64_t *) data + (i >> 3),
|
||||
ndwords);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue