From 18095ae25a85443dd190d11d0df2b80d60ecb968 Mon Sep 17 00:00:00 2001 From: adabreuti <76965454+adabreuti@users.noreply.github.com> Date: Wed, 15 Dec 2021 01:27:48 -0600 Subject: [PATCH] Optimize TI Task stack sizes (#13010) * Optimize TI Task stack sizes * Apply formatting fixes --- src/platform/cc13x2_26x2/BLEManagerImpl.cpp | 12 ++++++------ src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h | 4 +++- src/platform/cc13x2_26x2/FreeRTOSConfig.h | 5 +++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/platform/cc13x2_26x2/BLEManagerImpl.cpp b/src/platform/cc13x2_26x2/BLEManagerImpl.cpp index e917cedeee1066..218855fe3827dc 100644 --- a/src/platform/cc13x2_26x2/BLEManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/BLEManagerImpl.cpp @@ -664,12 +664,12 @@ CHIP_ERROR BLEManagerImpl::CreateEventHandler(void) BaseType_t xReturned; /* Create the task, storing the handle. */ - xReturned = xTaskCreate(EventHandler, /* Function that implements the task. */ - "ble_hndlr", /* Text name for the task. */ - 4096 / sizeof(uint32_t), /* Stack size in words, not bytes. */ - this, /* Parameter passed into the task. */ - ICALL_TASK_PRIORITIES, /* Keep priority the same as ICALL until init is complete */ - NULL); /* Used to pass out the created task's handle. */ + xReturned = xTaskCreate(EventHandler, /* Function that implements the task. */ + "ble_hndlr", /* Text name for the task. */ + BLEMANAGER_EVENT_HANDLER_STACK_SIZE, /* Stack size in words, not bytes. */ + this, /* Parameter passed into the task. */ + ICALL_TASK_PRIORITIES, /* Keep priority the same as ICALL until init is complete */ + NULL); /* Used to pass out the created task's handle. */ if (xReturned == errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY) { diff --git a/src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h b/src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h index 45398c4cfa9a73..ed7532d5ca1ea2 100644 --- a/src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h +++ b/src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h @@ -41,7 +41,9 @@ #define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE (8192) -#define BLEMANAGER_EVENT_HANDLER_STACK_SIZE (4096) +#define CHIP_DEVICE_CONFIG_THREAD_TASK_STACK_SIZE (7168) + +#define BLEMANAGER_EVENT_HANDLER_STACK_SIZE (924) #define BLEMANAGER_EVENT_HANDLER_PRIORITY (2) #define CHIP_DEVICE_CONFIG_ENABLE_THREAD 1 diff --git a/src/platform/cc13x2_26x2/FreeRTOSConfig.h b/src/platform/cc13x2_26x2/FreeRTOSConfig.h index 1d3798b6c8dcc3..e5af86c4ac7073 100644 --- a/src/platform/cc13x2_26x2/FreeRTOSConfig.h +++ b/src/platform/cc13x2_26x2/FreeRTOSConfig.h @@ -58,7 +58,7 @@ /* Constants that describe the hardware and memory usage. */ #define configCPU_CLOCK_HZ ((unsigned long) 48000000) -#define configMINIMAL_STACK_SIZE ((unsigned short) 1024) +#define configMINIMAL_STACK_SIZE ((unsigned short) 512) #define configMAX_TASK_NAME_LEN (12) /* FreeRTOS heap size is 0 because currently "bget" heap is the @@ -105,8 +105,9 @@ #define configUSE_TIMERS 1 #define configTIMER_TASK_PRIORITY (6) #define configTIMER_QUEUE_LENGTH (20) -#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2) +#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE) #define configIDLE_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE) + #define configENABLE_BACKWARD_COMPATIBILITY 1 #if defined(__TI_COMPILER_VERSION__) || defined(__ti_version__)