summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-11-26 16:15:12 +0700
committerhathach <[email protected]>2025-11-26 16:15:12 +0700
commitf63b67211b808fa370c51f3ab8eb201b64d3d1d2 (patch)
tree1291564ee93043ee8b4498bf242ac954d084c511
parentc925277e24e6743b311199d87461befe8b590187 (diff)
dwc2 stm32 check if dcache enabled before calling SCB DCache function
-rw-r--r--src/portable/synopsys/dwc2/dwc2_stm32.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/portable/synopsys/dwc2/dwc2_stm32.h b/src/portable/synopsys/dwc2/dwc2_stm32.h
index 9da8de41f..516eb021b 100644
--- a/src/portable/synopsys/dwc2/dwc2_stm32.h
+++ b/src/portable/synopsys/dwc2/dwc2_stm32.h
@@ -337,6 +337,9 @@ TU_ATTR_ALWAYS_INLINE static inline uint32_t round_up_to_cache_line_size(uint32_
}
TU_ATTR_ALWAYS_INLINE static inline bool is_cache_mem(uintptr_t addr) {
+ if (0 == (SCB->CCR & SCB_CCR_DC_Msk)) {
+ return false; // D-Cache is disabled
+ }
for (unsigned int i = 0; i < TU_ARRAY_SIZE(uncached_regions); i++) {
if (uncached_regions[i].start <= addr && addr <= uncached_regions[i].end) { return false; }
}