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

kasjer 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 a58d86e61 hw/mcu: STM32H7 Add dcache support
a58d86e61 is described below

commit a58d86e61686557118ed3e28b13a1aa5021522fb
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Fri May 22 23:22:25 2026 +0200

    hw/mcu: STM32H7 Add dcache support
    
    Device supports DCache now it's enabled by default.
---
 hw/mcu/stm/stm32h7xx/src/clock_stm32h7xx.c |  5 -----
 hw/mcu/stm/stm32h7xx/src/hal_system_init.c | 11 ++++++++++-
 hw/mcu/stm/stm32h7xx/syscfg.yml            |  4 ++++
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/hw/mcu/stm/stm32h7xx/src/clock_stm32h7xx.c 
b/hw/mcu/stm/stm32h7xx/src/clock_stm32h7xx.c
index 3ed90d418..3a12a9175 100644
--- a/hw/mcu/stm/stm32h7xx/src/clock_stm32h7xx.c
+++ b/hw/mcu/stm/stm32h7xx/src/clock_stm32h7xx.c
@@ -50,11 +50,6 @@ SystemClock_Config(void)
     RCC_PeriphCLKInitTypeDef per_clk_init = {0};
     HAL_StatusTypeDef status;
 
-    /* Enable the MCU instruction cache */
-#if MYNEWT_VAL(STM32_ENABLE_ICACHE)
-    SCB_EnableICache();
-#endif
-
     /*
      *  Supply configuration update enable
      */
diff --git a/hw/mcu/stm/stm32h7xx/src/hal_system_init.c 
b/hw/mcu/stm/stm32h7xx/src/hal_system_init.c
index 8bd31e745..bec62d8c2 100644
--- a/hw/mcu/stm/stm32h7xx/src/hal_system_init.c
+++ b/hw/mcu/stm/stm32h7xx/src/hal_system_init.c
@@ -33,7 +33,16 @@ hal_system_init(void)
     /* Update SystemCoreClock global variable */
     SystemCoreClockUpdate();
 
+    /* Enable the instruction cache */
+#if MYNEWT_VAL(STM32_ENABLE_ICACHE)
+    SCB_EnableICache();
+#endif
+
+    /* Enable the data cache */
+#if MYNEWT_VAL(STM32_ENABLE_DCACHE)
+    SCB_EnableDCache();
+#endif
+
     /* Relocate the vector table */
     NVIC_Relocate();
 }
-
diff --git a/hw/mcu/stm/stm32h7xx/syscfg.yml b/hw/mcu/stm/stm32h7xx/syscfg.yml
index 708862f65..68e893bf7 100644
--- a/hw/mcu/stm/stm32h7xx/syscfg.yml
+++ b/hw/mcu/stm/stm32h7xx/syscfg.yml
@@ -34,6 +34,10 @@ syscfg.defs:
         description: Enable instruction caching
         value: 1
 
+    STM32_ENABLE_DCACHE:
+        description: Enable data caching
+        value: 1
+
     STM32_CLOCK_VOLTAGESCALING_CONFIG:
         description: Voltage scale
         value: 0

Reply via email to