summaryrefslogtreecommitdiff
path: root/ports/stm32/flash.h
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2023-11-01 19:12:09 +1100
committerDamien George <damien@micropython.org>2024-01-08 12:33:34 +1100
commitb6ab9e420b0a874eb2f8f6b7597430ed9e526bf7 (patch)
treec323b9c7839b3037169a4ae1f28eafcade531fb0 /ports/stm32/flash.h
parentcf115918e66bea460256661848d9198ca6ca994d (diff)
stm32/flash: Change flash_erase to only erase a single sector at a time.
An erase sector sits in a given flash bank and some MCUs have two flash banks. If trying to erase a range of sectors and that range crosses from one flash bank into the next, the original implementation of `flash_erase()` would not handle this case and would do the wrong thing. This commit changes `flash_erase()` to only erase a single sector, which sidesteps the need to handle flash-bank-crossing. Most callers of this function only need to erase a single sector anyway. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/stm32/flash.h')
-rw-r--r--ports/stm32/flash.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/ports/stm32/flash.h b/ports/stm32/flash.h
index ecda923db..e5ba35cf7 100644
--- a/ports/stm32/flash.h
+++ b/ports/stm32/flash.h
@@ -28,7 +28,7 @@
bool flash_is_valid_addr(uint32_t addr);
int32_t flash_get_sector_info(uint32_t addr, uint32_t *start_addr, uint32_t *size);
-int flash_erase(uint32_t flash_dest, uint32_t num_word32);
+int flash_erase(uint32_t flash_dest);
int flash_write(uint32_t flash_dest, const uint32_t *src, uint32_t num_word32);
#endif // MICROPY_INCLUDED_STM32_FLASH_H