diff --git a/arch/arm/core/aarch32/cortex_m/Kconfig b/arch/arm/core/aarch32/cortex_m/Kconfig index 5c8bfad88a..169d5bc838 100644 --- a/arch/arm/core/aarch32/cortex_m/Kconfig +++ b/arch/arm/core/aarch32/cortex_m/Kconfig @@ -352,7 +352,13 @@ config CORTEX_M_DWT Enable and use the Data Watchpoint and Trace (DWT) unit for timing functions. -# Additional stack for tests when building with FPU_SHARING +config CORTEX_M_DEBUG_MONITOR_HOOK + bool "Debug monitor interrupt for debugging" + depends on !ARMV6_M_ARMV8_M_BASELINE + help + Enable this option to configure debug monitor exception to low priority + for debugging purposes. + # enabled, which may increase ESF stacking requirements for # threads. config TEST_EXTRA_STACK_SIZE diff --git a/arch/arm/include/aarch32/cortex_m/exc.h b/arch/arm/include/aarch32/cortex_m/exc.h index b0cc623c5a..b4f1b6cd8f 100644 --- a/arch/arm/include/aarch32/cortex_m/exc.h +++ b/arch/arm/include/aarch32/cortex_m/exc.h @@ -112,7 +112,9 @@ static ALWAYS_INLINE void z_arm_exc_setup(void) NVIC_SetPriority(MemoryManagement_IRQn, _EXC_FAULT_PRIO); NVIC_SetPriority(BusFault_IRQn, _EXC_FAULT_PRIO); NVIC_SetPriority(UsageFault_IRQn, _EXC_FAULT_PRIO); -#if defined(CONFIG_CPU_CORTEX_M_HAS_DWT) +#if defined(CONFIG_CORTEX_M_DEBUG_MONITOR_HOOK) + NVIC_SetPriority(DebugMonitor_IRQn, IRQ_PRIO_LOWEST); +#elif defined(CONFIG_CPU_CORTEX_M_HAS_DWT) NVIC_SetPriority(DebugMonitor_IRQn, _EXC_FAULT_PRIO); #endif #if defined(CONFIG_ARM_SECURE_FIRMWARE)