From 22b9865495d647a4bb81d4294dc6384f77b9795f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= Date: Sat, 28 Oct 2017 16:15:39 +0200 Subject: [PATCH] cortexm_common: Introduce CPU_NOSLEEP to disable all sleep at compile time --- cpu/cortexm_common/include/cpu.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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); }