diff --git a/cpu/cortexm_common/include/cpu.h b/cpu/cortexm_common/include/cpu.h index 2d3d7aa701d9b..b0e95f5046e40 100644 --- a/cpu/cortexm_common/include/cpu.h +++ b/cpu/cortexm_common/include/cpu.h @@ -41,6 +41,15 @@ extern "C" { #endif +/** + * @brief Set this to 1 to disable all sleep (useful for debugging) + * + * Example: CFLAGS=-DCPU_NOSLEEP make flash + */ +#ifndef CPU_NOSLEEP +#define CPU_NOSLEEP 0 +#endif + /** * @brief Interrupt stack canary value * @@ -96,6 +105,9 @@ static inline void cortexm_sleep_until_event(void) */ static inline void cortexm_sleep(int deep) { + if (CPU_NOSLEEP) { + return; + } if (deep) { SCB->SCR |= (SCB_SCR_SLEEPDEEP_Msk); }