diff options
Diffstat (limited to 'mcu/sys-stm32f103.c')
-rw-r--r-- | mcu/sys-stm32f103.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mcu/sys-stm32f103.c b/mcu/sys-stm32f103.c index 05e1f2f..81d8ec1 100644 --- a/mcu/sys-stm32f103.c +++ b/mcu/sys-stm32f103.c @@ -213,7 +213,11 @@ static int flash_write (uint32_t dst_addr, const uint8_t *src, size_t len) { int status; +#if defined(STM32F103_OVERRIDE_FLASH_SIZE_KB) + uint32_t flash_end = FLASH_START_ADDR + STM32F103_OVERRIDE_FLASH_SIZE_KB*1024; +#else uint32_t flash_end = FLASH_START_ADDR + (*FLASH_SIZE_REG)*1024; +#endif if (dst_addr < FLASH_START || dst_addr + len > flash_end) return 0; @@ -269,7 +273,11 @@ static void __attribute__((naked)) flash_erase_all_and_exec (void (*entry)(void)) { uint32_t addr = FLASH_START; +#if defined(STM32F103_OVERRIDE_FLASH_SIZE_KB) + uint32_t end = FLASH_START_ADDR + STM32F103_OVERRIDE_FLASH_SIZE_KB*1024; +#else uint32_t end = FLASH_START_ADDR + (*FLASH_SIZE_REG)*1024; +#endif uint32_t page_size = 1024; int r; |