Skip to content

Commit c8c39bf

Browse files
arch: stm32: fix undeclared page variable in flash write
Fix a compilation error in stm32f10xxf30xx_flash.c where the variable `page` is used without being declared in up_progmem_write(). The issue appears when STM32_FLASH_DUAL_BANK is enabled. The page index is now derived from the write address using up_progmem_getpage() and used for bank selection. Signed-off-by: Adwait Godbole <adwaitngodbole@gmail.com>
1 parent 16e2aa0 commit c8c39bf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/arm/src/stm32/stm32f10xxf30xx_flash.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,11 @@ ssize_t up_progmem_write(size_t addr, const void *buf, size_t count)
291291
uintptr_t base;
292292
uint16_t *hword = (uint16_t *)buf;
293293
size_t written = count;
294+
size_t page;
294295
int ret;
295296

297+
page = up_progmem_getpage(addr);
298+
296299
#if defined(STM32_FLASH_DUAL_BANK)
297300
/* Handle paged FLASH */
298301

0 commit comments

Comments
 (0)