From 2ddec2f0a9c3734ae1643aa010de3fc23c3db5af Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Wed, 14 May 2025 22:09:53 +0100 Subject: [PATCH] arch: arm: update to use CMSIS_6 compatible macros Zephyr switched to using CMSIS_6 module in f726cb51 which breaks certain boards like `nucleo_h745zi_q/stm32h745xx/m7` when CONFIG_CORTEX_M_DWT, CONFIG_TIMING_FUNCTIONS are enabled and cmsis from `module/hal/cmsis` is not available (deleted explicitly after west update). This commit adds a provision to be able to use CMSIS_6 macros when the module cmsis is not available. Signed-off-by: Sudan Landge --- arch/arm/include/cortex_m/dwt.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/cortex_m/dwt.h b/arch/arm/include/cortex_m/dwt.h index 947b35dca92..fe946ecb590 100644 --- a/arch/arm/include/cortex_m/dwt.h +++ b/arch/arm/include/cortex_m/dwt.h @@ -32,12 +32,18 @@ extern "C" { /* Define DWT LSR masks which are currently not defined by the CMSIS V5.1.2. * (LSR register is defined but not its bitfields). * Reuse ITM LSR mask as it is the same offset than DWT LSR one. + * TODO: update these to use only CMSIS_6 when all of zephyr and modules have + * update to CMSIS_6. */ #if !defined DWT_LSR_Present_Msk -#define DWT_LSR_Present_Msk ITM_LSR_Present_Msk +#define DWT_LSR_Present_Msk \ + IF_ENABLED(CONFIG_ZEPHYR_CMSIS_MODULE, (ITM_LSR_Present_Msk)) \ + IF_DISABLED(CONFIG_ZEPHYR_CMSIS_MODULE, (ITM_LSR_PRESENT_Msk)) #endif #if !defined DWT_LSR_Access_Msk -#define DWT_LSR_Access_Msk ITM_LSR_Access_Msk +#define DWT_LSR_Access_Msk \ + IF_ENABLED(CONFIG_ZEPHYR_CMSIS_MODULE, (ITM_LSR_Access_Msk)) \ + IF_DISABLED(CONFIG_ZEPHYR_CMSIS_MODULE, (ITM_LSR_ACCESS_Msk)) #endif static inline void dwt_access(bool ena)