You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2019/03/29 07:15:45 UTC

[mynewt-core] branch master updated: stm32f1xx: Fix sector erase

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 95cdf5b  stm32f1xx: Fix sector erase
95cdf5b is described below

commit 95cdf5b6214545f037cfc7ff6020ab9848e6bc90
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Thu Mar 28 16:44:52 2019 +0100

    stm32f1xx: Fix sector erase
    
    Invalid pre-condition was used before sector erase.
    This affects only f1xx platform, other STM32 versions
    have correct condition if needed.
---
 hw/mcu/stm/stm32f1xx/src/hal_flash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/mcu/stm/stm32f1xx/src/hal_flash.c b/hw/mcu/stm/stm32f1xx/src/hal_flash.c
index 64d607d..b03865e 100644
--- a/hw/mcu/stm/stm32f1xx/src/hal_flash.c
+++ b/hw/mcu/stm/stm32f1xx/src/hal_flash.c
@@ -32,7 +32,7 @@ stm32_mcu_flash_erase_sector(const struct hal_flash *dev, uint32_t sector_addres
 
     (void)PageError;
 
-    if ((sector_address & (_FLASH_SECTOR_SIZE - 1)) == sector_address) {
+    if ((sector_address & ~(_FLASH_SECTOR_SIZE - 1)) == sector_address) {
         eraseinit.TypeErase = FLASH_TYPEERASE_PAGES;
         eraseinit.Banks = FLASH_BANK_1;
         eraseinit.PageAddress = sector_address;