Skip to content

Commit cd78083

Browse files
committed
arch: arm: dwt: select the DWM macro based on the architecture
Change the selector for the DWT_LSR_Present_Msk and DWT_LSR_Access_Msk aliases to be based on the architecture rather than which module is present in the system. This makes the module build correctly if the cmsis module is present but not used and cmsis_6 is supposed to be used instead (i.e. for Cortex-M). Signed-off-by: Fabio Baltieri <[email protected]>
1 parent 6413185 commit cd78083

File tree

1 file changed

+11
-6
lines changed
  • arch/arm/include/cortex_m

1 file changed

+11
-6
lines changed

arch/arm/include/cortex_m/dwt.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,20 @@ extern "C" {
3636
* update to CMSIS_6.
3737
*/
3838
#if !defined DWT_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))
39+
#ifdef CONFIG_CPU_CORTEX_M
40+
#define DWT_LSR_Present_Msk ITM_LSR_PRESENT_Msk
41+
#else
42+
#define DWT_LSR_Present_Msk ITM_LSR_Present_Msk
4243
#endif
44+
#endif /*!defined DWT_LSR_Present_Msk */
45+
4346
#if !defined DWT_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))
47+
#ifdef CONFIG_CPU_CORTEX_M
48+
#define DWT_LSR_Access_Msk ITM_LSR_ACCESS_Msk
49+
#else
50+
#define DWT_LSR_Access_Msk ITM_LSR_Access_Msk
4751
#endif
52+
#endif /* !defined DWT_LSR_Access_Msk */
4853

4954
static inline void dwt_access(bool ena)
5055
{

0 commit comments

Comments
 (0)