From ca0d670eacd36291ba477565604f20c979146969 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niccol=C3=B2=20Betto?= <niccolo.betto@skywarder.eu>
Date: Wed, 24 Apr 2024 23:50:02 +0200
Subject: [PATCH] [Miosix] Enable JTAG_DISABLE_SLEEP by default

Disallow the CPU from going to sleep in the idle thread as JTAG debuggers lose communication with the device if it enters sleep mode
---
 src/bsps/stm32f429zi_death_stack_v1/config/miosix_settings.h    | 2 +-
 src/bsps/stm32f429zi_death_stack_v2/config/miosix_settings.h    | 2 +-
 src/bsps/stm32f429zi_death_stack_v3/config/miosix_settings.h    | 2 +-
 src/bsps/stm32f429zi_nokia/config/miosix_settings.h             | 2 +-
 src/bsps/stm32f429zi_parafoil/config/miosix_settings.h          | 2 +-
 src/bsps/stm32f429zi_pyxis_auxiliary/config/miosix_settings.h   | 2 +-
 src/bsps/stm32f429zi_rig/config/miosix_settings.h               | 2 +-
 src/bsps/stm32f756zg_nucleo/config/miosix_settings.h            | 2 +-
 .../stm32f767zi_automated_antennas/config/miosix_settings.h     | 2 +-
 src/bsps/stm32f767zi_compute_unit/config/miosix_settings.h      | 2 +-
 src/bsps/stm32f767zi_death_stack_v4/config/miosix_settings.h    | 2 +-
 src/bsps/stm32f767zi_gemini_gs/config/miosix_settings.h         | 2 +-
 src/bsps/stm32f767zi_gemini_motor/config/miosix_settings.h      | 2 +-
 13 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/bsps/stm32f429zi_death_stack_v1/config/miosix_settings.h b/src/bsps/stm32f429zi_death_stack_v1/config/miosix_settings.h
index dcffa1b92..10946aeba 100644
--- a/src/bsps/stm32f429zi_death_stack_v1/config/miosix_settings.h
+++ b/src/bsps/stm32f429zi_death_stack_v1/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
diff --git a/src/bsps/stm32f429zi_death_stack_v2/config/miosix_settings.h b/src/bsps/stm32f429zi_death_stack_v2/config/miosix_settings.h
index 5006e0bca..aaee8b547 100644
--- a/src/bsps/stm32f429zi_death_stack_v2/config/miosix_settings.h
+++ b/src/bsps/stm32f429zi_death_stack_v2/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
diff --git a/src/bsps/stm32f429zi_death_stack_v3/config/miosix_settings.h b/src/bsps/stm32f429zi_death_stack_v3/config/miosix_settings.h
index cdef9ddab..ee7e8487d 100644
--- a/src/bsps/stm32f429zi_death_stack_v3/config/miosix_settings.h
+++ b/src/bsps/stm32f429zi_death_stack_v3/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
diff --git a/src/bsps/stm32f429zi_nokia/config/miosix_settings.h b/src/bsps/stm32f429zi_nokia/config/miosix_settings.h
index 2b82675b7..760430d5c 100644
--- a/src/bsps/stm32f429zi_nokia/config/miosix_settings.h
+++ b/src/bsps/stm32f429zi_nokia/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
diff --git a/src/bsps/stm32f429zi_parafoil/config/miosix_settings.h b/src/bsps/stm32f429zi_parafoil/config/miosix_settings.h
index 5006e0bca..aaee8b547 100644
--- a/src/bsps/stm32f429zi_parafoil/config/miosix_settings.h
+++ b/src/bsps/stm32f429zi_parafoil/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
diff --git a/src/bsps/stm32f429zi_pyxis_auxiliary/config/miosix_settings.h b/src/bsps/stm32f429zi_pyxis_auxiliary/config/miosix_settings.h
index 5006e0bca..aaee8b547 100644
--- a/src/bsps/stm32f429zi_pyxis_auxiliary/config/miosix_settings.h
+++ b/src/bsps/stm32f429zi_pyxis_auxiliary/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
diff --git a/src/bsps/stm32f429zi_rig/config/miosix_settings.h b/src/bsps/stm32f429zi_rig/config/miosix_settings.h
index 5fe66bf6c..5bb339e02 100644
--- a/src/bsps/stm32f429zi_rig/config/miosix_settings.h
+++ b/src/bsps/stm32f429zi_rig/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
diff --git a/src/bsps/stm32f756zg_nucleo/config/miosix_settings.h b/src/bsps/stm32f756zg_nucleo/config/miosix_settings.h
index 25ff28235..924bbc52a 100644
--- a/src/bsps/stm32f756zg_nucleo/config/miosix_settings.h
+++ b/src/bsps/stm32f756zg_nucleo/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
diff --git a/src/bsps/stm32f767zi_automated_antennas/config/miosix_settings.h b/src/bsps/stm32f767zi_automated_antennas/config/miosix_settings.h
index 5a19de638..4df5735ce 100644
--- a/src/bsps/stm32f767zi_automated_antennas/config/miosix_settings.h
+++ b/src/bsps/stm32f767zi_automated_antennas/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
diff --git a/src/bsps/stm32f767zi_compute_unit/config/miosix_settings.h b/src/bsps/stm32f767zi_compute_unit/config/miosix_settings.h
index e1ca4aac6..64b0670ca 100644
--- a/src/bsps/stm32f767zi_compute_unit/config/miosix_settings.h
+++ b/src/bsps/stm32f767zi_compute_unit/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
diff --git a/src/bsps/stm32f767zi_death_stack_v4/config/miosix_settings.h b/src/bsps/stm32f767zi_death_stack_v4/config/miosix_settings.h
index 5fe66bf6c..5bb339e02 100644
--- a/src/bsps/stm32f767zi_death_stack_v4/config/miosix_settings.h
+++ b/src/bsps/stm32f767zi_death_stack_v4/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
diff --git a/src/bsps/stm32f767zi_gemini_gs/config/miosix_settings.h b/src/bsps/stm32f767zi_gemini_gs/config/miosix_settings.h
index 1b49a8e7c..a83f2a517 100644
--- a/src/bsps/stm32f767zi_gemini_gs/config/miosix_settings.h
+++ b/src/bsps/stm32f767zi_gemini_gs/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
diff --git a/src/bsps/stm32f767zi_gemini_motor/config/miosix_settings.h b/src/bsps/stm32f767zi_gemini_motor/config/miosix_settings.h
index e1ca4aac6..64b0670ca 100644
--- a/src/bsps/stm32f767zi_gemini_motor/config/miosix_settings.h
+++ b/src/bsps/stm32f767zi_gemini_motor/config/miosix_settings.h
@@ -153,7 +153,7 @@ const unsigned char MAX_OPEN_FILES = 8;
  * mode, so to use debugging it is necessary to disable sleep in the idle
  * thread. By default it is not defined (idle thread calls sleep).
  */
-//#define JTAG_DISABLE_SLEEP
+#define JTAG_DISABLE_SLEEP
 
 #if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
 #error Deep sleep cannot work together with jtag
-- 
GitLab