From 20b080f9a24232e53e17dd37b1113710559606b7 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Fri, 20 Mar 2020 12:17:46 -0700 Subject: [PATCH 1/2] Control SysView by CFG_SYSVIEW Of course, this commit ensures the following: * Zero change to BSP defaults * Zero change to compiled code * Zero change to UI / menu options --- boards.txt | 20 ++++++++++---------- cores/nRF5/WInterrupts.c | 4 ++-- cores/nRF5/freertos/config/FreeRTOSConfig.h | 4 ++-- cores/nRF5/main.cpp | 6 +++--- cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.c | 4 ++-- libraries/Wire/Wire_nRF52.cpp | 8 ++++---- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/boards.txt b/boards.txt index 91da1a72..2958c518 100644 --- a/boards.txt +++ b/boards.txt @@ -59,7 +59,7 @@ feather52832.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 feather52832.menu.debug.l2=Level 2 (Full Debug) feather52832.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 feather52832.menu.debug.l3=Level 3 (Segger SystemView) -feather52832.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52832.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 # ---------------------------------- # Bluefruit Feather nRF52840 Express @@ -112,7 +112,7 @@ feather52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 feather52840.menu.debug.l2=Level 2 (Full Debug) feather52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 feather52840.menu.debug.l3=Level 3 (Segger SystemView) -feather52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 # ---------------------------------- @@ -166,7 +166,7 @@ feather52840sense.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 feather52840sense.menu.debug.l2=Level 2 (Full Debug) feather52840sense.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 feather52840sense.menu.debug.l3=Level 3 (Segger SystemView) -feather52840sense.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52840sense.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 # --------------------------------------------- @@ -220,7 +220,7 @@ itsybitsy52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 itsybitsy52840.menu.debug.l2=Level 2 (Full Debug) itsybitsy52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 itsybitsy52840.menu.debug.l3=Level 3 (Segger SystemView) -itsybitsy52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +itsybitsy52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 # --------------------------------------------- # Bluefruit Circuit Playground nRF52840 Express @@ -273,7 +273,7 @@ cplaynrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 cplaynrf52840.menu.debug.l2=Level 2 (Full Debug) cplaynrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 cplaynrf52840.menu.debug.l3=Level 3 (Segger SystemView) -cplaynrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +cplaynrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 # --------------------------------------------- @@ -327,7 +327,7 @@ cluenrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 cluenrf52840.menu.debug.l2=Level 2 (Full Debug) cluenrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 cluenrf52840.menu.debug.l3=Level 3 (Segger SystemView) -cluenrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +cluenrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 # ---------------------------------- # Bluefruit Metro nRF52840 Express @@ -380,7 +380,7 @@ metro52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 metro52840.menu.debug.l2=Level 2 (Full Debug) metro52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 metro52840.menu.debug.l3=Level 3 (Segger SystemView) -metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 @@ -433,7 +433,7 @@ pca10056.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 pca10056.menu.debug.l2=Level 2 (Full Debug) pca10056.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 pca10056.menu.debug.l3=Level 3 (Segger SystemView) -pca10056.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +pca10056.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 # ---------------------------------- # Particle Xenon @@ -486,7 +486,7 @@ particle_xenon.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 particle_xenon.menu.debug.l2=Level 2 (Full Debug) particle_xenon.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 particle_xenon.menu.debug.l3=Level 3 (Segger SystemView) -particle_xenon.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +particle_xenon.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 # ---------------------------------- # Raytac MDBT50Q - RX @@ -539,4 +539,4 @@ mdbt50qrx.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 mdbt50qrx.menu.debug.l2=Level 2 (Full Debug) mdbt50qrx.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 mdbt50qrx.menu.debug.l3=Level 3 (Segger SystemView) -mdbt50qrx.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +mdbt50qrx.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 diff --git a/cores/nRF5/WInterrupts.c b/cores/nRF5/WInterrupts.c index dce18ca7..a03352f0 100644 --- a/cores/nRF5/WInterrupts.c +++ b/cores/nRF5/WInterrupts.c @@ -144,7 +144,7 @@ void detachInterrupt(uint32_t pin) void GPIOTE_IRQHandler() { -#if CFG_DEBUG >= 3 +#if CFG_SYSVIEW SEGGER_SYSVIEW_RecordEnterISR(); #endif @@ -171,7 +171,7 @@ void GPIOTE_IRQHandler() event = (uint32_t)((uint32_t)event + 4); } -#if CFG_DEBUG >= 3 +#if CFG_SYSVIEW SEGGER_SYSVIEW_RecordExitISR(); #endif } diff --git a/cores/nRF5/freertos/config/FreeRTOSConfig.h b/cores/nRF5/freertos/config/FreeRTOSConfig.h index 7b03755a..e463dd30 100644 --- a/cores/nRF5/freertos/config/FreeRTOSConfig.h +++ b/cores/nRF5/freertos/config/FreeRTOSConfig.h @@ -196,8 +196,8 @@ standard names - or at least those used in the unmodified vector table. */ */ #define configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG 0 -// Sysview require at least debug level 3 -#if CFG_DEBUG >= 3 +// Sysview is enabled by default at debug level 3 +#if CFG_SYSVIEW #include "sysview/SEGGER_SYSVIEW_FreeRTOS.h" #endif diff --git a/cores/nRF5/main.cpp b/cores/nRF5/main.cpp index 62f3ca30..49f9bc85 100644 --- a/cores/nRF5/main.cpp +++ b/cores/nRF5/main.cpp @@ -24,8 +24,8 @@ void Bluefruit_printInfo() __attribute__((weak)); void Bluefruit_printInfo() {} #endif -// DEBUG Level 3 -#if CFG_DEBUG >= 3 +// From the UI, setting debug level to 3 will enable SysView +#if CFG_SYSVIEW #include "SEGGER_SYSVIEW.h" #endif @@ -80,7 +80,7 @@ int main( void ) Adafruit_TinyUSB_Core_init(); #endif -#if CFG_DEBUG >= 3 +#if CFG_SYSVIEW SEGGER_SYSVIEW_Conf(); #endif diff --git a/cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.c b/cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.c index d51cb576..8c16927b 100644 --- a/cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.c +++ b/cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.c @@ -52,7 +52,7 @@ Purpose : Interface between FreeRTOS and SystemView. Revision: $Rev: 7947 $ */ -#if CFG_DEBUG >= 3 +#if CFG_SYSVIEW #include "FreeRTOS.h" #include "task.h" @@ -252,6 +252,6 @@ const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = { _cbSendTaskList, }; -#endif // CFG_DEBUG >= 3 +#endif // CFG_SYSVIEW /*************************** End of file ****************************/ diff --git a/libraries/Wire/Wire_nRF52.cpp b/libraries/Wire/Wire_nRF52.cpp index 83ee636c..39043059 100755 --- a/libraries/Wire/Wire_nRF52.cpp +++ b/libraries/Wire/Wire_nRF52.cpp @@ -399,13 +399,13 @@ extern "C" { void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void) { - #if CFG_DEBUG >= 3 + #if CFG_SYSVIEW SEGGER_SYSVIEW_RecordEnterISR(); #endif Wire.onService(); - #if CFG_DEBUG >= 3 + #if CFG_SYSVIEW SEGGER_SYSVIEW_RecordExitISR(); #endif } @@ -419,13 +419,13 @@ extern "C" { void SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler(void) { - #if CFG_DEBUG >= 3 + #if CFG_SYSVIEW SEGGER_SYSVIEW_RecordEnterISR(); #endif Wire1.onService(); - #if CFG_DEBUG >= 3 + #if CFG_SYSVIEW SEGGER_SYSVIEW_RecordExitISR(); #endif } From a9e109d0478e88ccde1671376bf43f74e3792858 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Wed, 25 Mar 2020 16:48:45 -0700 Subject: [PATCH 2/2] Prevent double-definition on compilation Boards.txt should have updated multiple settings debug level of 3, not attempted to stuff multiple settings into the same variable. --- boards.txt | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/boards.txt b/boards.txt index 2958c518..8e60ca44 100644 --- a/boards.txt +++ b/boards.txt @@ -59,7 +59,8 @@ feather52832.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 feather52832.menu.debug.l2=Level 2 (Full Debug) feather52832.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 feather52832.menu.debug.l3=Level 3 (Segger SystemView) -feather52832.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 +feather52832.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52832.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 # ---------------------------------- # Bluefruit Feather nRF52840 Express @@ -112,7 +113,8 @@ feather52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 feather52840.menu.debug.l2=Level 2 (Full Debug) feather52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 feather52840.menu.debug.l3=Level 3 (Segger SystemView) -feather52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 +feather52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 # ---------------------------------- @@ -166,7 +168,8 @@ feather52840sense.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 feather52840sense.menu.debug.l2=Level 2 (Full Debug) feather52840sense.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 feather52840sense.menu.debug.l3=Level 3 (Segger SystemView) -feather52840sense.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 +feather52840sense.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +feather52840sense.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 # --------------------------------------------- @@ -220,7 +223,8 @@ itsybitsy52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 itsybitsy52840.menu.debug.l2=Level 2 (Full Debug) itsybitsy52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 itsybitsy52840.menu.debug.l3=Level 3 (Segger SystemView) -itsybitsy52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 +itsybitsy52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +itsybitsy52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 # --------------------------------------------- # Bluefruit Circuit Playground nRF52840 Express @@ -273,7 +277,8 @@ cplaynrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 cplaynrf52840.menu.debug.l2=Level 2 (Full Debug) cplaynrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 cplaynrf52840.menu.debug.l3=Level 3 (Segger SystemView) -cplaynrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 +cplaynrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +cplaynrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 # --------------------------------------------- @@ -327,7 +332,8 @@ cluenrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 cluenrf52840.menu.debug.l2=Level 2 (Full Debug) cluenrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 cluenrf52840.menu.debug.l3=Level 3 (Segger SystemView) -cluenrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 +cluenrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +cluenrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 # ---------------------------------- # Bluefruit Metro nRF52840 Express @@ -380,7 +386,8 @@ metro52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 metro52840.menu.debug.l2=Level 2 (Full Debug) metro52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 metro52840.menu.debug.l3=Level 3 (Segger SystemView) -metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 +metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +metro52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 @@ -433,7 +440,8 @@ pca10056.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 pca10056.menu.debug.l2=Level 2 (Full Debug) pca10056.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 pca10056.menu.debug.l3=Level 3 (Segger SystemView) -pca10056.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 +pca10056.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +pca10056.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 # ---------------------------------- # Particle Xenon @@ -486,7 +494,8 @@ particle_xenon.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 particle_xenon.menu.debug.l2=Level 2 (Full Debug) particle_xenon.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 particle_xenon.menu.debug.l3=Level 3 (Segger SystemView) -particle_xenon.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 +particle_xenon.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +particle_xenon.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1 # ---------------------------------- # Raytac MDBT50Q - RX @@ -539,4 +548,5 @@ mdbt50qrx.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 mdbt50qrx.menu.debug.l2=Level 2 (Full Debug) mdbt50qrx.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 mdbt50qrx.menu.debug.l3=Level 3 (Segger SystemView) -mdbt50qrx.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 -DCFG_SYSVIEW=1 +mdbt50qrx.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3 +mdbt50qrx.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1