You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2017/04/26 22:41:19 UTC
[31/50] [abbrv] incubator-mynewt-core git commit: stm32f4xx,
erase flash should wait for complete
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/bluetooth5
Commit: cabdff917d4494d6bce6aabdace0533a44b3b2c8
Parents: 271ab1b
Author: wesley <we...@wolinke.com>
Authored: Sun Apr 23 12:39:55 2017 +0800
Committer: wesley <we...@wolinke.com>
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