From 64b05d33aabbedf8ac544c407e428cba93b145f3 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Sat, 7 Mar 2020 15:54:38 -0800 Subject: [PATCH 01/20] Fix stack trace debug level check --- cores/nRF5/common_func.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/nRF5/common_func.h b/cores/nRF5/common_func.h index 71e1fd65..39d395ff 100644 --- a/cores/nRF5/common_func.h +++ b/cores/nRF5/common_func.h @@ -142,7 +142,7 @@ const char* dbg_err_str(int32_t err_id); // TODO move to other place #define PRINT_LOCATION() PRINTF("%s: %d:\n", __PRETTY_FUNCTION__, __LINE__) #define PRINT_MESS(x) PRINTF("%s: %d: %s \n" , __FUNCTION__, __LINE__, (char*)(x)) -#define PRTNT_HEAP() if (CFG_DEBUG == 3) PRINTF("\n%s: %d: Heap free: %d\n", __FUNCTION__, __LINE__, util_heap_get_free_size()) +#define PRTNT_HEAP() if (CFG_DEBUG >= 3) PRINTF("\n%s: %d: Heap free: %d\n", __FUNCTION__, __LINE__, util_heap_get_free_size()) #define PRINT_STR(x) PRINTF("%s: %d: " #x " = %s\n" , __FUNCTION__, __LINE__, (char*)(x) ) #define PRINT_INT(x) PRINTF("%s: %d: " #x " = %ld\n" , __FUNCTION__, __LINE__, (uint32_t) (x) ) #define PRINT_FLOAT(x) PRINTF("%s: %d: " #x " = %f\n" , __FUNCTION__, __LINE__, (float) (x) ) From 4565d0cd7d1dd2a940e50e1137f6d2a7cac472ca Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Sat, 7 Mar 2020 15:59:12 -0800 Subject: [PATCH 02/20] Use uppercase PRINTF. This is a step in preparation for the ability to change the default handler for printf(), such as when advanced debug output capabilities make it more performant to output via an alternative route. --- cores/nRF5/utility/debug.cpp | 68 +++++++++---------- cores/nRF5/verify.h | 8 +-- .../Adafruit_LittleFS/src/littlefs/lfs_util.h | 6 +- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/cores/nRF5/utility/debug.cpp b/cores/nRF5/utility/debug.cpp index 4bbe866a..666fd32b 100644 --- a/cores/nRF5/utility/debug.cpp +++ b/cores/nRF5/utility/debug.cpp @@ -106,14 +106,14 @@ static void printMemRegion(const char* name, uint32_t top, uint32_t bottom, uint sprintf(buffer, "%lu", top-bottom); } - printf("| %-5s| 0x%04X - 0x%04X | %-19s |\n", name, (uint16_t) bottom, (uint16_t) (top-1), buffer); + PRINTF("| %-5s| 0x%04X - 0x%04X | %-19s |\n", name, (uint16_t) bottom, (uint16_t) (top-1), buffer); } void dbgMemInfo(void) { - printf(" ______________________________________________\n"); - printf("| Name | Addr 0x2000xxxx | Usage |\n"); - printf("| ---------------------------------------------|\n"); + PRINTF(" ______________________________________________\n"); + PRINTF("| Name | Addr 0x2000xxxx | Usage |\n"); + PRINTF("| ---------------------------------------------|\n"); // Pritn SRAM used for Stack executed by Softdevice and ISR printMemRegion("Stack", ((uint32_t) __StackTop), ((uint32_t) __StackLimit), dbgStackUsed() ); @@ -127,8 +127,8 @@ void dbgMemInfo(void) // Print SRAM Used by SoftDevice printMemRegion("SD", (uint32_t) __data_start__, 0x20000000, 0); - printf("|______________________________________________|\n"); - printf("\n"); + PRINTF("|______________________________________________|\n"); + PRINTF("\n"); // Print Task list uint32_t tasknum = uxTaskGetNumberOfTasks(); @@ -136,20 +136,20 @@ void dbgMemInfo(void) vTaskList(buf); - printf("Task State Prio StackLeft Num\n"); - printf("-----------------------------------\n"); - printf(buf); - printf("\n"); + PRINTF("Task State Prio StackLeft Num\n"); + PRINTF("-----------------------------------\n"); + PRINTF(buf); + PRINTF("\n"); rtos_free(buf); } void dbgPrintVersion(void) { - printf("\n"); - printf("BSP Library : " ARDUINO_BSP_VERSION "\n"); - printf("Bootloader : %s\n", getBootloaderVersion()); - printf("Serial No : %s\n", getMcuUniqueID()); - printf("\n"); + PRINTF("\n"); + PRINTF("BSP Library : " ARDUINO_BSP_VERSION "\n"); + PRINTF("Bootloader : %s\n", getBootloaderVersion()); + PRINTF("Serial No : %s\n", getMcuUniqueID()); + PRINTF("\n"); } /******************************************************************************/ @@ -163,7 +163,7 @@ static void dump_str_line(uint8_t const* buf, uint16_t count) for(int i=0; i Date: Sat, 7 Mar 2020 16:00:51 -0800 Subject: [PATCH 03/20] Use `Print` class reference This is in preparation for enabling output to be provided via other, potentially more performant, modes. --- .../src/services/BLEAdafruitQuaternion.cpp | 4 +- libraries/Bluefruit52Lib/src/BLEPeriph.cpp | 16 +-- libraries/Bluefruit52Lib/src/bluefruit.cpp | 110 +++++++++--------- 3 files changed, 68 insertions(+), 62 deletions(-) diff --git a/libraries/BLEAdafruitService/src/services/BLEAdafruitQuaternion.cpp b/libraries/BLEAdafruitService/src/services/BLEAdafruitQuaternion.cpp index a53436c2..a38fc633 100644 --- a/libraries/BLEAdafruitService/src/services/BLEAdafruitQuaternion.cpp +++ b/libraries/BLEAdafruitService/src/services/BLEAdafruitQuaternion.cpp @@ -134,7 +134,9 @@ void BLEAdafruitQuaternion::_update_timer(int32_t ms) #if CFG_DEBUG static void print_quaternion(float quater[4]) { - Serial.printf("Quaternion: %.04f, %.04f, %.04f, %.04f\n", quater[0], quater[1], quater[2], quater[3]); + // prepare for ability to change output, based on compile-time flags + Print& logger = Serial; + logger.printf("Quaternion: %.04f, %.04f, %.04f, %.04f\n", quater[0], quater[1], quater[2], quater[3]); } #endif diff --git a/libraries/Bluefruit52Lib/src/BLEPeriph.cpp b/libraries/Bluefruit52Lib/src/BLEPeriph.cpp index 303cf478..bd4894ec 100644 --- a/libraries/Bluefruit52Lib/src/BLEPeriph.cpp +++ b/libraries/Bluefruit52Lib/src/BLEPeriph.cpp @@ -151,14 +151,16 @@ void BLEPeriph::_eventHandler(ble_evt_t* evt) void BLEPeriph::printInfo(void) { char const * title_fmt = "%-16s: "; + // prepare for ability to change output, based on compile-time flags + Print& logger = Serial; - Serial.printf(title_fmt, "Conn Intervals"); - Serial.printf("min = %.2f ms, ", _ppcp.min_conn_interval*1.25f); - Serial.printf("max = %.2f ms", _ppcp.max_conn_interval*1.25f); - Serial.println(); + logger.printf(title_fmt, "Conn Intervals"); + logger.printf("min = %.2f ms, ", _ppcp.min_conn_interval*1.25f); + logger.printf("max = %.2f ms", _ppcp.max_conn_interval*1.25f); + logger.println(); - Serial.printf(title_fmt, "Conn Timeout"); - Serial.printf("%d ms", _ppcp.conn_sup_timeout*10); - Serial.println(); + logger.printf(title_fmt, "Conn Timeout"); + logger.printf("%d ms", _ppcp.conn_sup_timeout*10); + logger.println(); } diff --git a/libraries/Bluefruit52Lib/src/bluefruit.cpp b/libraries/Bluefruit52Lib/src/bluefruit.cpp index 4593aca1..8e750fb5 100644 --- a/libraries/Bluefruit52Lib/src/bluefruit.cpp +++ b/libraries/Bluefruit52Lib/src/bluefruit.cpp @@ -971,120 +971,122 @@ void AdafruitBluefruit::printInfo(void) { // Skip if Serial is not initialised if ( !Serial ) return; + // prepare for ability to change output, based on compile-time flags + Print& logger = Serial; // Skip if Bluefruit.begin() is not called if ( _ble_event_sem == NULL ) return; - Serial.println("--------- SoftDevice Config ---------"); + logger.println("--------- SoftDevice Config ---------"); char const * title_fmt = "%-16s: "; /*------------- SoftDevice Config -------------*/ // Max uuid128 - Serial.printf(title_fmt, "Max UUID128"); - Serial.println(_sd_cfg.uuid128_max); + logger.printf(title_fmt, "Max UUID128"); + logger.println(_sd_cfg.uuid128_max); // ATTR Table Size - Serial.printf(title_fmt, "ATTR Table Size"); - Serial.println(_sd_cfg.attr_table_size); + logger.printf(title_fmt, "ATTR Table Size"); + logger.println(_sd_cfg.attr_table_size); // Service Changed - Serial.printf(title_fmt, "Service Changed"); - Serial.println(_sd_cfg.service_changed); + logger.printf(title_fmt, "Service Changed"); + logger.println(_sd_cfg.service_changed); if ( _prph_count ) { - Serial.println("Peripheral Connect Setting"); + logger.println("Peripheral Connect Setting"); - Serial.print(" - "); - Serial.printf(title_fmt, "Max MTU"); - Serial.println(_sd_cfg.prph.mtu_max); + logger.print(" - "); + logger.printf(title_fmt, "Max MTU"); + logger.println(_sd_cfg.prph.mtu_max); - Serial.print(" - "); - Serial.printf(title_fmt, "Event Length"); - Serial.println(_sd_cfg.prph.event_len); + logger.print(" - "); + logger.printf(title_fmt, "Event Length"); + logger.println(_sd_cfg.prph.event_len); - Serial.print(" - "); - Serial.printf(title_fmt, "HVN Queue Size"); - Serial.println(_sd_cfg.prph.hvn_qsize); + logger.print(" - "); + logger.printf(title_fmt, "HVN Queue Size"); + logger.println(_sd_cfg.prph.hvn_qsize); - Serial.print(" - "); - Serial.printf(title_fmt, "WrCmd Queue Size"); - Serial.println(_sd_cfg.prph.wrcmd_qsize); + logger.print(" - "); + logger.printf(title_fmt, "WrCmd Queue Size"); + logger.println(_sd_cfg.prph.wrcmd_qsize); } if ( _central_count ) { - Serial.println("Central Connect Setting"); + logger.println("Central Connect Setting"); - Serial.print(" - "); - Serial.printf(title_fmt, "Max MTU"); - Serial.println(_sd_cfg.central.mtu_max); + logger.print(" - "); + logger.printf(title_fmt, "Max MTU"); + logger.println(_sd_cfg.central.mtu_max); - Serial.print(" - "); - Serial.printf(title_fmt, "Event Length"); - Serial.println(_sd_cfg.central.event_len); + logger.print(" - "); + logger.printf(title_fmt, "Event Length"); + logger.println(_sd_cfg.central.event_len); - Serial.print(" - "); - Serial.printf(title_fmt, "HVN Queue Size"); - Serial.println(_sd_cfg.central.hvn_qsize); + logger.print(" - "); + logger.printf(title_fmt, "HVN Queue Size"); + logger.println(_sd_cfg.central.hvn_qsize); - Serial.print(" - "); - Serial.printf(title_fmt, "WrCmd Queue Size"); - Serial.println(_sd_cfg.central.wrcmd_qsize); + logger.print(" - "); + logger.printf(title_fmt, "WrCmd Queue Size"); + logger.println(_sd_cfg.central.wrcmd_qsize); } /*------------- Settings -------------*/ - Serial.println("\n--------- BLE Settings ---------"); + logger.println("\n--------- BLE Settings ---------"); // Name - Serial.printf(title_fmt, "Name"); + logger.printf(title_fmt, "Name"); { char name[32]; memclr(name, sizeof(name)); getName(name, sizeof(name)); - Serial.printf(name); + logger.printf(name); } - Serial.println(); + logger.println(); // Max Connections - Serial.printf(title_fmt, "Max Connections"); - Serial.printf("Peripheral = %d, ", _prph_count); - Serial.printf("Central = %d ", _central_count); - Serial.println(); + logger.printf(title_fmt, "Max Connections"); + logger.printf("Peripheral = %d, ", _prph_count); + logger.printf("Central = %d ", _central_count); + logger.println(); // Address - Serial.printf(title_fmt, "Address"); + logger.printf(title_fmt, "Address"); { char const * type_str[] = { "Public", "Static", "Private Resolvable", "Private Non Resolvable" }; ble_gap_addr_t gap_addr = this->getAddr(); // MAC is in little endian --> print reverse - Serial.printBufferReverse(gap_addr.addr, 6, ':'); - Serial.printf(" (%s)", type_str[gap_addr.addr_type]); + logger.printBufferReverse(gap_addr.addr, 6, ':'); + logger.printf(" (%s)", type_str[gap_addr.addr_type]); } - Serial.println(); + logger.println(); // Tx Power - Serial.printf(title_fmt, "TX Power"); - Serial.printf("%d dBm", _tx_power); - Serial.println(); + logger.printf(title_fmt, "TX Power"); + logger.printf("%d dBm", _tx_power); + logger.println(); - Periph.printInfo(); + logger.printInfo(); /*------------- List the paried device -------------*/ if ( _prph_count ) { - Serial.printf(title_fmt, "Peripheral Paired Devices"); - Serial.println(); + logger.printf(title_fmt, "Peripheral Paired Devices"); + logger.println(); bond_print_list(BLE_GAP_ROLE_PERIPH); } if ( _central_count ) { - Serial.printf(title_fmt, "Central Paired Devices"); - Serial.println(); + logger.printf(title_fmt, "Central Paired Devices"); + logger.println(); bond_print_list(BLE_GAP_ROLE_CENTRAL); } - Serial.println(); + logger.println(); } From b8fb0cd1e170b72050e847579a2fdd1345581be9 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Sat, 7 Mar 2020 16:03:40 -0800 Subject: [PATCH 04/20] Add locations for two additional defines. The two defines that can later be generated in a user's own boards.local.txt (or platforms.local.txt) are: build.logger_flags build.sysview_flags To be used for the following `#define` identifiers: -DCFG_LOGGER=0 -DCFG_SYSVIEW=0 NOTE: These are NOT defined by default. This is preparation for enabling alternative debug output locations. --- platform.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform.txt b/platform.txt index 5d16d6ef..72ae3175 100644 --- a/platform.txt +++ b/platform.txt @@ -56,8 +56,9 @@ build.debug_flags=-DCFG_DEBUG=0 rtos.path={build.core.path}/freertos nordic.path={build.core.path}/nordic - -build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DLFS_NAME_MAX=64 -Ofast {build.debug_flags} "-I{build.core.path}/cmsis/include" "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{build.core.path}/TinyUSB" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src" +# build.logger_flags and build.sysview_flags and intentionally empty, +# to allow modification via a user's own boards.local.txt or platform.local.txt files. +build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DLFS_NAME_MAX=64 -Ofast {build.debug_flags} {build.logger_flags} {build.sysview_flags} "-I{build.core.path}/cmsis/include" "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{build.core.path}/TinyUSB" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src" # usb flags build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' From 03805f3c33edc9878c4ab0abcd953793aed63c0f Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Wed, 11 Mar 2020 11:59:45 -0700 Subject: [PATCH 05/20] Define PRINTF macro regardless of debug level. --- cores/nRF5/common_func.h | 13 +++++++------ cores/nRF5/utility/debug.cpp | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cores/nRF5/common_func.h b/cores/nRF5/common_func.h index 39d395ff..be9a868e 100644 --- a/cores/nRF5/common_func.h +++ b/cores/nRF5/common_func.h @@ -116,6 +116,13 @@ //--------------------------------------------------------------------+ const char* dbg_err_str(int32_t err_id); // TODO move to other place +#if __cplusplus +#define PRINTF ::printf +#else +#define PRINTF printf +#endif + + #if CFG_DEBUG #define LOG_LV1(...) ADALOG(__VA_ARGS__) #define LOG_LV1_BUFFER(...) ADALOG_BUFFER(__VA_ARGS__) @@ -134,12 +141,6 @@ const char* dbg_err_str(int32_t err_id); // TODO move to other place #if CFG_DEBUG -#if __cplusplus -#define PRINTF ::printf -#else -#define PRINTF printf -#endif - #define PRINT_LOCATION() PRINTF("%s: %d:\n", __PRETTY_FUNCTION__, __LINE__) #define PRINT_MESS(x) PRINTF("%s: %d: %s \n" , __FUNCTION__, __LINE__, (char*)(x)) #define PRTNT_HEAP() if (CFG_DEBUG >= 3) PRINTF("\n%s: %d: Heap free: %d\n", __FUNCTION__, __LINE__, util_heap_get_free_size()) diff --git a/cores/nRF5/utility/debug.cpp b/cores/nRF5/utility/debug.cpp index 666fd32b..33118c30 100644 --- a/cores/nRF5/utility/debug.cpp +++ b/cores/nRF5/utility/debug.cpp @@ -39,6 +39,7 @@ #include #include #include +#include // defined in linker script extern uint32_t __data_start__[]; From 7777bd9796376b10f2625f4c291e7a381c212047 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Wed, 11 Mar 2020 15:11:45 -0700 Subject: [PATCH 06/20] Enable CI --- .travis.yml.bck => .travis.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .travis.yml.bck => .travis.yml (100%) diff --git a/.travis.yml.bck b/.travis.yml similarity index 100% rename from .travis.yml.bck rename to .travis.yml From 47d1b4d23f33c537e6d9a6fe38b227053cfce3d6 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Wed, 11 Mar 2020 15:19:30 -0700 Subject: [PATCH 07/20] Add defaults to global platforms.txt --- platform.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform.txt b/platform.txt index 72ae3175..a0897725 100644 --- a/platform.txt +++ b/platform.txt @@ -51,6 +51,8 @@ compiler.size.cmd=arm-none-eabi-size # this can be overriden in boards.txt build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float build.debug_flags=-DCFG_DEBUG=0 +build.logger_flags=-DCFG_LOGGER=1 +build.sysview_flags=-DCFG_SYSVIEW=0 # common compiler for nrf rtos.path={build.core.path}/freertos @@ -148,3 +150,4 @@ tools.bootburn.bootloader.pattern={program.burn_pattern} tools.bootburn.erase.params.verbose= tools.bootburn.erase.params.quiet= tools.bootburn.erase.pattern= + From 7fab012a3a0728873ed1f238038d86233bc752b5 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Wed, 11 Mar 2020 15:42:41 -0700 Subject: [PATCH 08/20] Undo accidental change --- libraries/Bluefruit52Lib/src/bluefruit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Bluefruit52Lib/src/bluefruit.cpp b/libraries/Bluefruit52Lib/src/bluefruit.cpp index 8e750fb5..363ab68d 100644 --- a/libraries/Bluefruit52Lib/src/bluefruit.cpp +++ b/libraries/Bluefruit52Lib/src/bluefruit.cpp @@ -1071,7 +1071,7 @@ void AdafruitBluefruit::printInfo(void) logger.printf("%d dBm", _tx_power); logger.println(); - logger.printInfo(); + Periph.printInfo(); /*------------- List the paried device -------------*/ if ( _prph_count ) From f532a27538b9563f71a0e32f7f0e95b2a1f0793f Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Wed, 11 Mar 2020 16:08:43 -0700 Subject: [PATCH 09/20] And disable Travis-CI once again. This is too bad, because it had powerful collapsing sections, which made tracking down and fixing problems so much easier... --- .travis.yml => .travis.yml.bck | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .travis.yml => .travis.yml.bck (100%) diff --git a/.travis.yml b/.travis.yml.bck similarity index 100% rename from .travis.yml rename to .travis.yml.bck From 2709813ea62ff57650515b7a7cb1fbcde484f3f8 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Wed, 11 Mar 2020 16:39:59 -0700 Subject: [PATCH 10/20] More printf() --> PRINTF() conversion --- libraries/Bluefruit52Lib/src/utility/bonding.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/Bluefruit52Lib/src/utility/bonding.cpp b/libraries/Bluefruit52Lib/src/utility/bonding.cpp index 9783ac5d..5c5f666a 100644 --- a/libraries/Bluefruit52Lib/src/utility/bonding.cpp +++ b/libraries/Bluefruit52Lib/src/utility/bonding.cpp @@ -250,14 +250,14 @@ void bond_print_list(uint8_t role) char devname[len]; file.read(devname, len); - printf(" %s : %s (%lu bytes)\n", file.name(), devname, file.size()); + PRINTF(" %s : %s (%lu bytes)\n", file.name(), devname, file.size()); } } file.close(); } - printf("\n"); + PRINTF("\n"); file.close(); dir.close(); From 045f4f8cca2839b83bb39fffad915a6f59b06fee Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 20 Mar 2020 11:32:42 +0700 Subject: [PATCH 11/20] partial revert PRITNF in lfs_util.h due to compilation error --- cores/nRF5/common_inc.h | 2 +- libraries/Adafruit_LittleFS/src/littlefs/lfs_util.h | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cores/nRF5/common_inc.h b/cores/nRF5/common_inc.h index dbc49ab3..51fbceeb 100644 --- a/cores/nRF5/common_inc.h +++ b/cores/nRF5/common_inc.h @@ -40,7 +40,7 @@ #include #include "compiler_macro.h" -#include "verify.h" #include "common_func.h" +#include "verify.h" #endif /* COMMON_INC_H_ */ diff --git a/libraries/Adafruit_LittleFS/src/littlefs/lfs_util.h b/libraries/Adafruit_LittleFS/src/littlefs/lfs_util.h index 953e4bd8..e992ee6f 100644 --- a/libraries/Adafruit_LittleFS/src/littlefs/lfs_util.h +++ b/libraries/Adafruit_LittleFS/src/littlefs/lfs_util.h @@ -24,8 +24,6 @@ #include #include -#include "FreeRTOS.h" - #ifndef LFS_NO_MALLOC #include #endif @@ -56,21 +54,21 @@ extern "C" // Logging functions #ifndef LFS_NO_DEBUG #define LFS_DEBUG(fmt, ...) \ - PRINTF("lfs debug:%d: " fmt "\n", __LINE__, __VA_ARGS__) + printf("lfs debug:%d: " fmt "\n", __LINE__, __VA_ARGS__) #else #define LFS_DEBUG(fmt, ...) #endif #ifndef LFS_NO_WARN #define LFS_WARN(fmt, ...) \ - PRINTF("lfs warn:%d: " fmt "\n", __LINE__, __VA_ARGS__) + printf("lfs warn:%d: " fmt "\n", __LINE__, __VA_ARGS__) #else #define LFS_WARN(fmt, ...) #endif #ifndef LFS_NO_ERROR #define LFS_ERROR(fmt, ...) \ - PRINTF("lfs error:%d: " fmt "\n", __LINE__, __VA_ARGS__) + printf("lfs error:%d: " fmt "\n", __LINE__, __VA_ARGS__) #else #define LFS_ERROR(fmt, ...) #endif From c91bed14486974c78bdacf8f2014870ab6dba52e Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Thu, 12 Mar 2020 22:50:41 -0700 Subject: [PATCH 12/20] Fix #458 Update HwPWM3 when it exists --- cores/nRF5/wiring_analog.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cores/nRF5/wiring_analog.cpp b/cores/nRF5/wiring_analog.cpp index a462fba2..570be9eb 100644 --- a/cores/nRF5/wiring_analog.cpp +++ b/cores/nRF5/wiring_analog.cpp @@ -50,9 +50,10 @@ extern "C" */ void analogWriteResolution( uint8_t res ) { - HwPWM0.setResolution(res); - HwPWM1.setResolution(res); - HwPWM2.setResolution(res); + for (int i = 0; isetResolution(res); + } } /** From a1d0d3e27d8421adfcce38834b714e42df44e9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich-Lorenz=20Schl=C3=BCter?= Date: Mon, 23 Mar 2020 13:22:04 +0100 Subject: [PATCH 13/20] Update platform.txt --- platform.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.txt b/platform.txt index 5bb7f639..4787c03f 100644 --- a/platform.txt +++ b/platform.txt @@ -79,10 +79,10 @@ compiler.elf2hex.extra_flags= # ---------------- ## Compile c files -recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BSP_VERSION="{version}" {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BSP_VERSION=\"{version}\" {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" ## Compile c++ files -recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BSP_VERSION="{version}" {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BSP_VERSION=\"{version}\" {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" ## Compile S files recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" From 43d723a07d46b9942b15098073aa04eda2bf6ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich-Lorenz=20Schl=C3=BCter?= Date: Mon, 23 Mar 2020 13:35:56 +0100 Subject: [PATCH 14/20] Update platform.txt As recommended --- platform.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.txt b/platform.txt index 5bb7f639..274a7e50 100644 --- a/platform.txt +++ b/platform.txt @@ -115,8 +115,8 @@ recipe.output.save_file_hexu={build.project_name}.save.hex ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" -recipe.size.regex=\.text\s+([0-9]+).* -recipe.size.regex.data=(\.data|\.bss|\.stack)\s+([0-9]+).* +recipe.size.regex=^(\.text|.\data)\s+([0-9]+).* +recipe.size.regex.data=^(\.data|\.bss)\s+([0-9]+).* ## Export Compiled Binary recipe.output.tmp_file={build.project_name}.hex From 1f97330f10c17c239811b7b63b98556ab7e41dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich-Lorenz=20Schl=C3=BCter?= Date: Mon, 23 Mar 2020 16:39:25 +0100 Subject: [PATCH 15/20] Update platform.txt regex for sizes like in https://github.com/arduino/ArduinoCore-samd/blob/master/platform.txt#L120 --- platform.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.txt b/platform.txt index 274a7e50..01bc8696 100644 --- a/platform.txt +++ b/platform.txt @@ -115,8 +115,8 @@ recipe.output.save_file_hexu={build.project_name}.save.hex ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" -recipe.size.regex=^(\.text|.\data)\s+([0-9]+).* -recipe.size.regex.data=^(\.data|\.bss)\s+([0-9]+).* +recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).* +recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).* ## Export Compiled Binary recipe.output.tmp_file={build.project_name}.hex From 74bf73acfcd58d5bba73240e1a1e5b56f2c5b75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich-Lorenz=20Schl=C3=BCter?= Date: Mon, 23 Mar 2020 16:57:49 +0100 Subject: [PATCH 16/20] Update platform.txt Tested in eclipse aduino-cdt --- platform.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform.txt b/platform.txt index 4787c03f..b2b78a08 100644 --- a/platform.txt +++ b/platform.txt @@ -79,10 +79,12 @@ compiler.elf2hex.extra_flags= # ---------------- ## Compile c files -recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BSP_VERSION=\"{version}\" {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' + {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" ## Compile c++ files -recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BSP_VERSION=\"{version}\" {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' + {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" ## Compile S files recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" From 99c777411e6b8f3ad6974e14e188579355499b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich-Lorenz=20Schl=C3=BCter?= Date: Mon, 23 Mar 2020 18:41:49 +0100 Subject: [PATCH 17/20] Update platform.txt Removed redundant linebreak --- platform.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/platform.txt b/platform.txt index b2b78a08..1d71fbdd 100644 --- a/platform.txt +++ b/platform.txt @@ -79,12 +79,10 @@ compiler.elf2hex.extra_flags= # ---------------- ## Compile c files -recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' - {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" ## Compile c++ files -recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' - {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" ## Compile S files recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" From ed2183a1ed45cd6e7f24e02f0ae2a518921ca315 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Tue, 24 Mar 2020 12:31:39 -0700 Subject: [PATCH 18/20] Update all nRF52840 boards to match linker See commit https://github.com/adafruit/Adafruit_nRF52_Arduino/commit/583ad02a increase sd attribute table size from 0x800 to 0xC00, increase linker memory for SD 840 from 3400 to 6000 Since the linker is updated, all nRF52840 boards using that linker file should also be updated. --- boards.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boards.txt b/boards.txt index 36feee3b..91da1a72 100644 --- a/boards.txt +++ b/boards.txt @@ -298,7 +298,7 @@ cluenrf52840.upload.protocol=nrfutil cluenrf52840.upload.use_1200bps_touch=true cluenrf52840.upload.wait_for_upload_port=true cluenrf52840.upload.maximum_size=815104 -cluenrf52840.upload.maximum_data_size=248832 +cluenrf52840.upload.maximum_data_size=237568 # Build cluenrf52840.build.mcu=cortex-m4 @@ -457,7 +457,7 @@ particle_xenon.upload.protocol=nrfutil particle_xenon.upload.use_1200bps_touch=true particle_xenon.upload.wait_for_upload_port=true particle_xenon.upload.maximum_size=815104 -particle_xenon.upload.maximum_data_size=248832 +particle_xenon.upload.maximum_data_size=237568 # Build particle_xenon.build.mcu=cortex-m4 @@ -510,7 +510,7 @@ mdbt50qrx.upload.protocol=nrfutil mdbt50qrx.upload.use_1200bps_touch=true mdbt50qrx.upload.wait_for_upload_port=true mdbt50qrx.upload.maximum_size=815104 -mdbt50qrx.upload.maximum_data_size=248832 +mdbt50qrx.upload.maximum_data_size=237568 # Build mdbt50qrx.build.mcu=cortex-m4 From 20b080f9a24232e53e17dd37b1113710559606b7 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Fri, 20 Mar 2020 12:17:46 -0700 Subject: [PATCH 19/20] 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 20/20] 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