Skip to content

Commit 4b10b57

Browse files
committed
Fixed FLASH_BASE_ADDRESS if FLASH_BANK1_END is not defined
Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
1 parent 7ee0f17 commit 4b10b57

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cores/arduino/stm32/stm32_eeprom.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@
7070
*/
7171
// We use the last page of the flash to store data (to prevent code overwritten).
7272
#if defined (STM32F0xx) || defined (STM32F1xx) || defined(STM32L1xx)
73-
#ifdef FLASH_BANK2_END
73+
#if defined (FLASH_BANK2_END)
7474
#define FLASH_BASE_ADDRESS ((uint32_t)((FLASH_BANK2_END + 1) - FLASH_PAGE_SIZE))
75-
#else
75+
#elif defined (FLASH_BANK1_END)
7676
#define FLASH_BASE_ADDRESS ((uint32_t)((FLASH_BANK1_END + 1) - FLASH_PAGE_SIZE))
77+
#else
78+
#define FLASH_BASE_ADDRESS ((uint32_t)((FLASH_END + 1) - FLASH_PAGE_SIZE))
7779
#endif // FLASH_BANK2_END
7880
#elif defined (STM32F2xx) || defined (STM32F4xx) || defined (STM32F7xx)
7981
#define FLASH_BASE_ADDRESS ((uint32_t)(FLASH_END + 1) - FLASH_PAGE_SIZE)

0 commit comments

Comments
 (0)