You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2018/08/14 13:07:30 UTC
[mynewt-core] branch master updated: [STM32L4] Remove error
clearing on flash driver
This is an automated email from the ASF dual-hosted git repository.
utzig 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 eea6039 [STM32L4] Remove error clearing on flash driver
eea6039 is described below
commit eea60391e032c8f325560230fe1bfaa05c684ffc
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Tue Aug 14 09:03:37 2018 -0300
[STM32L4] Remove error clearing on flash driver
This removes custom error clearing code. Calls to `erase` and
`program` already do pretty good error checking and clearing on both
beginning/end. This code was causing flash corruption when swap
upgrades were performed with interruptions.
---
hw/mcu/stm/stm32l4xx/src/hal_flash.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/hw/mcu/stm/stm32l4xx/src/hal_flash.c b/hw/mcu/stm/stm32l4xx/src/hal_flash.c
index 3dc49db..bbe5a42 100644
--- a/hw/mcu/stm/stm32l4xx/src/hal_flash.c
+++ b/hw/mcu/stm/stm32l4xx/src/hal_flash.c
@@ -78,16 +78,7 @@ stm32l4_flash_write(const struct hal_flash *dev, uint32_t address,
align = dev->hf_align;
num_dwords = ((num_bytes - 1) / align) + 1;
- /* clear previous errors */
- __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_SR_ERRORS);
-
for (i = 0; i < num_dwords; i++) {
- /*
- * FIXME: need to check why PGSERR gets set in this loop
- * no obvious reason so far...
- */
- __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGSERR);
-
if (num_bytes < 8) {
memcpy(&val, &((uint8_t *)src)[i * align], num_bytes);
memset((uint64_t *)&val + num_bytes, 0xff, align - num_bytes);
@@ -127,11 +118,6 @@ stm32l4_flash_erase_sector(const struct hal_flash *dev, uint32_t sector_address)
(void)PageError;
if (!(sector_address & (_FLASH_SECTOR_SIZE - 1))) {
- /* FIXME: why is an err flag set? */
-
- /* Clear status of previous operation. */
- __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_SR_ERRORS);
-
eraseinit.TypeErase = FLASH_TYPEERASE_PAGES;
if ((sector_address - dev->hf_base_addr) < (_FLASH_SIZE / 2)) {
eraseinit.Banks = FLASH_BANK_1;