Skip to content

Commit 34909c4

Browse files
committed
arch: arm: update to use CMSIS_6 compatible macros
Zephyr switched to using CMSIS_6 module in f726cb5 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 <[email protected]>
1 parent a675360 commit 34909c4

File tree

1 file changed

+8
-2
lines changed
  • arch/arm/include/cortex_m

1 file changed

+8
-2
lines changed

arch/arm/include/cortex_m/dwt.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,18 @@ extern "C" {
3232
/* Define DWT LSR masks which are currently not defined by the CMSIS V5.1.2.
3333
* (LSR register is defined but not its bitfields).
3434
* Reuse ITM LSR mask as it is the same offset than DWT LSR one.
35+
* TODO: update these to use only CMSIS_6 when all of zephyr and modules have
36+
* update to CMSIS_6.
3537
*/
3638
#if !defined DWT_LSR_Present_Msk
37-
#define DWT_LSR_Present_Msk ITM_LSR_Present_Msk
39+
#define DWT_LSR_Present_Msk \
40+
IF_ENABLED(CONFIG_ZEPHYR_CMSIS_MODULE, (ITM_LSR_Present_Msk)) \
41+
IF_DISABLED(CONFIG_ZEPHYR_CMSIS_MODULE, (ITM_LSR_PRESENT_Msk))
3842
#endif
3943
#if !defined DWT_LSR_Access_Msk
40-
#define DWT_LSR_Access_Msk ITM_LSR_Access_Msk
44+
#define DWT_LSR_Access_Msk \
45+
IF_ENABLED(CONFIG_ZEPHYR_CMSIS_MODULE, (ITM_LSR_Access_Msk)) \
46+
IF_DISABLED(CONFIG_ZEPHYR_CMSIS_MODULE, (ITM_LSR_ACCESS_Msk))
4147
#endif
4248

4349
static inline void dwt_access(bool ena)

0 commit comments

Comments
 (0)