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 a93815156 mcu/stm32u5: Fix flash write
a93815156 is described below

commit a93815156445d8eaa0867a3df5eba466108f9623
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Thu Jul 6 08:39:48 2023 +0200

    mcu/stm32u5: Fix flash write
    
    STM32U5 devices require quad writes (128 bits).
    64 bits writes result in error so write size is extended.
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/mcu/stm/stm32_common/src/hal_flash.c | 2 ++
 hw/mcu/stm/stm32u5xx/syscfg.yml         | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/mcu/stm/stm32_common/src/hal_flash.c 
b/hw/mcu/stm/stm32_common/src/hal_flash.c
index d7e32c928..f5dc80c9f 100644
--- a/hw/mcu/stm/stm32_common/src/hal_flash.c
+++ b/hw/mcu/stm/stm32_common/src/hal_flash.c
@@ -100,6 +100,8 @@ stm32_flash_write_linear(const struct hal_flash *dev, 
uint32_t address,
     num_words = ((num_bytes - 1) >> 2) + 1;
 #elif MYNEWT_VAL(MCU_FLASH_MIN_WRITE_SIZE) == 8
     num_words = ((num_bytes - 1) >> 3) + 1;
+#elif MYNEWT_VAL(MCU_FLASH_MIN_WRITE_SIZE) == 16
+    num_words = ((num_bytes - 1) >> 4) + 1;
 #else
     #error "Unsupported MCU_FLASH_MIN_WRITE_SIZE"
 #endif
diff --git a/hw/mcu/stm/stm32u5xx/syscfg.yml b/hw/mcu/stm/stm32u5xx/syscfg.yml
index 5dd68c53a..4d3c3c305 100644
--- a/hw/mcu/stm/stm32u5xx/syscfg.yml
+++ b/hw/mcu/stm/stm32u5xx/syscfg.yml
@@ -21,7 +21,7 @@ syscfg.defs:
         description: >
             Specifies the required alignment for internal flash writes.
             Used internally by the newt tool.
-        value: 8
+        value: 16
 
     MCU_STM32U5:
         description: MCUs are of STM32U5xx family

Reply via email to