From 3efdbc018a0558b3aecd31e3a292111e624db2dc Mon Sep 17 00:00:00 2001 From: Martin Kojtal <0xc0170@gmail.com> Date: Tue, 8 Aug 2017 09:50:17 +0100 Subject: [PATCH] STM32F4: fix for 2nd back sector Use ADDR_FLASH_SECTOR_12 as this is defined by target (the flash size varies, for instance for some F437xx is up to 2MB (2nd bank might not be there)). --- targets/TARGET_STM/TARGET_STM32F4/flash_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/TARGET_STM/TARGET_STM32F4/flash_api.c b/targets/TARGET_STM/TARGET_STM32F4/flash_api.c index 485023a57c..a173c0a196 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/flash_api.c +++ b/targets/TARGET_STM/TARGET_STM32F4/flash_api.c @@ -151,7 +151,7 @@ static uint32_t GetSector(uint32_t address) uint32_t sector = 0; uint32_t tmp = address - ADDR_FLASH_SECTOR_0; /* This function supports 1Mb and 2Mb flash sizes */ -#if defined(FLASH_SECTOR_12) +#if defined(ADDR_FLASH_SECTOR_12) if (address & 0x100000) { // handle 2nd bank sector = FLASH_SECTOR_12; tmp = address - ADDR_FLASH_SECTOR_12;