Repository: incubator-mynewt-core Updated Branches: refs/heads/master 271ab1b9c -> ce47d8450
stm32f4xx, erase flash should wait for complete Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/cabdff91 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/cabdff91 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/cabdff91 Branch: refs/heads/master Commit: cabdff917d4494d6bce6aabdace0533a44b3b2c8 Parents: 271ab1b Author: wesley <[email protected]> Authored: Sun Apr 23 12:39:55 2017 +0800 Committer: wesley <[email protected]> Committed: Sun Apr 23 12:39:55 2017 +0800 ---------------------------------------------------------------------- hw/mcu/stm/stm32f4xx/src/hal_flash.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/cabdff91/hw/mcu/stm/stm32f4xx/src/hal_flash.c ---------------------------------------------------------------------- diff --git a/hw/mcu/stm/stm32f4xx/src/hal_flash.c b/hw/mcu/stm/stm32f4xx/src/hal_flash.c index bc36a3b..2b18772 100644 --- a/hw/mcu/stm/stm32f4xx/src/hal_flash.c +++ b/hw/mcu/stm/stm32f4xx/src/hal_flash.c @@ -106,7 +106,16 @@ stm32f4_flash_write(const struct hal_flash *dev, uint32_t address, static void stm32f4_flash_erase_sector_id(int sector_id) { - FLASH_Erase_Sector(sector_id, FLASH_VOLTAGE_RANGE_1); + FLASH_EraseInitTypeDef eraseinit; + uint32_t SectorError; + + eraseinit.TypeErase = FLASH_TYPEERASE_SECTORS; + eraseinit.Banks = 0; + eraseinit.Sector = sector_id; + eraseinit.NbSectors = 1; + eraseinit.VoltageRange = FLASH_VOLTAGE_RANGE_1; + + HAL_FLASHEx_Erase(&eraseinit, &SectorError); } static int
