From 6caf285234c3bc76cda1cc5b9f8161b969e88d8a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 7 May 2013 14:10:34 -0600 Subject: [PATCH] STM32 option to disable sleep to prevent disconnection of debugger --- arch/arm/src/stm32/Kconfig | 9 +++++++++ arch/arm/src/stm32/stm32_idle.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/arch/arm/src/stm32/Kconfig b/arch/arm/src/stm32/Kconfig index d7e3c7a350..0980795e88 100644 --- a/arch/arm/src/stm32/Kconfig +++ b/arch/arm/src/stm32/Kconfig @@ -861,6 +861,15 @@ config STM32_JTAG_SW_ENABLE endchoice +config STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG + bool "Disable IDLE Sleep (WFI) in debug mode" + default n + ---help--- + In debug configuration, disables the WFI instruction in the IDLE loop + to prevent the JTAG from disconnecting. With some JTAG debuggers, such + as the ST-LINK2 with OpenOCD, if the ARM is put to sleep via the WFI + instruction, the debugger will disconnect, terminating the debug session. + config STM32_FORCEPOWER bool "Force power" default n diff --git a/arch/arm/src/stm32/stm32_idle.c b/arch/arm/src/stm32/stm32_idle.c index 83a6808c58..60b81bea81 100644 --- a/arch/arm/src/stm32/stm32_idle.c +++ b/arch/arm/src/stm32/stm32_idle.c @@ -202,10 +202,12 @@ void up_idle(void) */ #if !defined(CONFIG_STM32_CONNECTIVITYLINE) || !defined(CONFIG_STM32_ETHMAC) +#if !(defined(CONFIG_DEBUG_SYMBOLS) && defined(CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG)) BEGIN_IDLE(); asm("WFI"); END_IDLE(); #endif #endif +#endif }