flash.c: fix write error for STM32H72x (#78)

flash.c: fix write error for STM32H72x

Add a flash lock/unlock sequence after erasing and before writing to the flash
memory

Signed off by: Robin Gay <robingay67@gmail.com>
This commit is contained in:
Robin GAY authored and GitHub committed 2023-07-10 16:44:25 -04:00
1 parent 10cc588874
commit 25482ba0d8
1 file changed
+7 -1
+7 -1
View File
@@ -218,9 +218,15 @@ flash_write_block(uint32_t block_address, uint32_t *data)
unlock_flash();
// Erase page
if (need_erase)
if (need_erase) {
erase_page(page_address);
// avoid triggering STM32H72xx write security
if (CONFIG_MACH_STM32H7) {
lock_flash();
unlock_flash();
}
}
// Write block
write_block(block_address, data);