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 2023-07-10 22:44:25 +02:00 committed by GitHub
parent 10cc588874
commit 25482ba0d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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