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

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 6c3e9ad7b1e59cde9d157679f3ccc3acc6ad7276
Author: Ricardo Maurizio Paul <[email protected]>
AuthorDate: Mon Oct 5 14:43:00 2026 +0200

    arch/arm/stm32h5: fix unused warnings in stm32_icache.c.
    
    An ICACHE build with no ICACHE region configured warns about two unused
    symbols:
    
    - stm32_icache_setup_region() is only called when one of the
      CONFIG_STM32_ICACHE_REGION0..3 options is set, so build it only then.
    - 'regval' in stm32_icache_initialize() is only used with
      CONFIG_STM32_ICACHE_DIRECT, so declare it only then.  The interrupt
      block gets its own local variable.
    
    No functional change.
    
    Assisted-by: Claude:claude-sonnet-5-5
    Signed-off-by: Ricardo Maurizio Paul <[email protected]>
---
 arch/arm/src/stm32h5/stm32_icache.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/arch/arm/src/stm32h5/stm32_icache.c 
b/arch/arm/src/stm32h5/stm32_icache.c
index 0d8272d22af..3c73d8c9770 100644
--- a/arch/arm/src/stm32h5/stm32_icache.c
+++ b/arch/arm/src/stm32h5/stm32_icache.c
@@ -217,6 +217,10 @@ static inline void stm32_icache_disable_monitors(void)
   putreg32(regval, STM32_ICACHE_CR);
 }
 
+#if defined(CONFIG_STM32_ICACHE_REGION0) || \
+    defined(CONFIG_STM32_ICACHE_REGION1) || \
+    defined(CONFIG_STM32_ICACHE_REGION2) || \
+    defined(CONFIG_STM32_ICACHE_REGION3)
 static void stm32_icache_setup_region(struct stm32_icache_region region)
 {
   uint32_t regval = 0;
@@ -232,10 +236,13 @@ static void stm32_icache_setup_region(struct 
stm32_icache_region region)
 
   putreg32(regval, STM32_ICACHE_CRR(region.num));
 }
+#endif
 
 void stm32_icache_initialize(void)
 {
+#ifdef CONFIG_STM32_ICACHE_DIRECT
   uint32_t regval;
+#endif
 
   /* Set associativity */
 
@@ -281,14 +288,14 @@ void stm32_icache_initialize(void)
 
   if (ret == OK)
     {
-      regval = 0;
+      uint32_t ier = 0;
 #  ifdef CONFIG_STM32_ICACHE_INV_INT
-      regval |= ICACHE_IER_BSYENDIE;
+      ier |= ICACHE_IER_BSYENDIE;
 #  endif
 #  ifdef CONFIG_STM32_ICACHE_ERR_INT
-      regval |= ICACHE_IER_ERRIE;
+      ier |= ICACHE_IER_ERRIE;
 #  endif
-      stm32_icache_set_ier(regval);
+      stm32_icache_set_ier(ier);
 
       up_enable_irq(STM32_IRQ_ICACHE);
     }

Reply via email to