From 17952257114916e08dbdff1e35b090695fc2a806 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs <112982107+lpbeliveau-silabs@users.noreply.github.com> Date: Thu, 17 Nov 2022 21:26:01 -0500 Subject: [PATCH] bugfix/ble_defines_mem_monitoring (#23531) * Added defines for BLE tasks to allow heap monitoring to get their task handles * Adjustements to keep previous task names size unless using heap monitoring and to have significative names when using heap monitoring * Restyled by clang-format Co-authored-by: Restyled.io Co-authored-by: Andrei Litvin --- examples/lighting-app/efr32/BUILD.gn | 4 ++++ examples/platform/efr32/FreeRTOSConfig.h | 6 ++++++ examples/platform/efr32/MemMonitoring.cpp | 3 +++ src/platform/EFR32/CHIPDevicePlatformConfig.h | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index 1ca1b41e2ce62b..616a66bf05a029 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -148,6 +148,10 @@ efr32_sdk("sdk") { "OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}", ] + if (enable_heap_monitoring) { + defines += [ "HEAP_MONITORING" ] + } + if (chip_enable_pw_rpc) { defines += [ "HAL_VCOM_ENABLE=1", diff --git a/examples/platform/efr32/FreeRTOSConfig.h b/examples/platform/efr32/FreeRTOSConfig.h index f42179230d6bb0..35d6e37bf5c813 100644 --- a/examples/platform/efr32/FreeRTOSConfig.h +++ b/examples/platform/efr32/FreeRTOSConfig.h @@ -181,7 +181,13 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ #define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG (1) /* See into vPortSuppressTicksAndSleep source code for explanation */ #define configMAX_PRIORITIES (56) #define configMINIMAL_STACK_SIZE (320) /* Number of words to use for Idle and Timer stacks */ + +#ifdef HEAP_MONITORING +#define configMAX_TASK_NAME_LEN (24) +#else #define configMAX_TASK_NAME_LEN (10) +#endif // HEAP_MONITORING + #define configUSE_16_BIT_TICKS (0) #define configIDLE_SHOULD_YIELD (1) #define configUSE_MUTEXES (1) diff --git a/examples/platform/efr32/MemMonitoring.cpp b/examples/platform/efr32/MemMonitoring.cpp index 36a9b44a19225d..08de06eaed18f9 100644 --- a/examples/platform/efr32/MemMonitoring.cpp +++ b/examples/platform/efr32/MemMonitoring.cpp @@ -22,6 +22,9 @@ #include "FreeRTOS.h" #include +#define BLE_STACK_TASK_NAME "Bluetooth stack" +#define BLE_LINK_TASK_NAME "Bluetooth linklayer" + static StackType_t monitoringStack[MONITORING_STACK_SIZE_byte / sizeof(StackType_t)]; static StaticTask_t monitoringTaskStruct; diff --git a/src/platform/EFR32/CHIPDevicePlatformConfig.h b/src/platform/EFR32/CHIPDevicePlatformConfig.h index 47c97eab4de37e..1843088c1e23d8 100644 --- a/src/platform/EFR32/CHIPDevicePlatformConfig.h +++ b/src/platform/EFR32/CHIPDevicePlatformConfig.h @@ -94,7 +94,7 @@ #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_TELEMETRY_FULL 0 #ifndef CHIP_DEVICE_CONFIG_BLE_APP_TASK_NAME -#define CHIP_DEVICE_CONFIG_BLE_APP_TASK_NAME "BLE_EVENT" +#define CHIP_DEVICE_CONFIG_BLE_APP_TASK_NAME "Bluetooth event handler" #endif // CHIP_DEVICE_CONFIG_BLE_APP_TASK_NAME #define CHIP_DEVICE_CONFIG_MAX_EVENT_QUEUE_SIZE 25