summaryrefslogtreecommitdiff
path: root/ports/stm32/flash.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-02-22 11:55:12 +1100
committerDamien George <damien@micropython.org>2022-02-04 09:43:43 +1100
commite0a0719416d6a936ade8c30314b7e9c90bfbbf23 (patch)
tree664c121740ea58d5ff38081f7321a022838d54a8 /ports/stm32/flash.c
parent9127e6370819b32552caedd0184f206e1b9c9285 (diff)
stm32: Add initial support for STM32WL MCUs.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/stm32/flash.c')
-rw-r--r--ports/stm32/flash.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ports/stm32/flash.c b/ports/stm32/flash.c
index eeeab5204..0c4d2cf5b 100644
--- a/ports/stm32/flash.c
+++ b/ports/stm32/flash.c
@@ -97,7 +97,7 @@ static const flash_layout_t flash_layout[] = {
};
#endif
-#elif defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB)
+#elif defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL)
static const flash_layout_t flash_layout[] = {
{ (uint32_t)FLASH_BASE, (uint32_t)FLASH_PAGE_SIZE, 512 },
@@ -159,7 +159,7 @@ static uint32_t get_page(uint32_t addr) {
}
#endif
-#elif (defined(STM32L4) && !defined(SYSCFG_MEMRMP_FB_MODE)) || defined(STM32WB)
+#elif (defined(STM32L4) && !defined(SYSCFG_MEMRMP_FB_MODE)) || defined(STM32WB) || defined(STM32WL)
static uint32_t get_page(uint32_t addr) {
return (addr - FLASH_BASE) / FLASH_PAGE_SIZE;
@@ -263,7 +263,7 @@ int flash_erase(uint32_t flash_dest, uint32_t num_word32) {
EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES;
EraseInitStruct.PageAddress = flash_dest;
EraseInitStruct.NbPages = (4 * num_word32 + FLASH_PAGE_SIZE - 4) / FLASH_PAGE_SIZE;
- #elif (defined(STM32L4) && !defined(SYSCFG_MEMRMP_FB_MODE)) || defined(STM32WB)
+ #elif (defined(STM32L4) && !defined(SYSCFG_MEMRMP_FB_MODE)) || defined(STM32WB) || defined(STM32WL)
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_ALL_ERRORS);
EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES;
EraseInitStruct.Page = get_page(flash_dest);
@@ -370,7 +370,7 @@ int flash_write(uint32_t flash_dest, const uint32_t *src, uint32_t num_word32) {
HAL_StatusTypeDef status = HAL_OK;
- #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB)
+ #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL)
// program the flash uint64 by uint64
for (int i = 0; i < num_word32 / 2; i++) {