From b3658b4eb1cccb84ed85e93670a87d7c74b8ee7c Mon Sep 17 00:00:00 2001 From: dongheng Date: Wed, 17 Apr 2019 10:11:57 +0800 Subject: [PATCH] feat(freertos): Add option for idle task stack size Modify min size from 768 to 1024 bytes. --- components/freertos/Kconfig | 12 ++++++++++++ components/freertos/freertos/tasks.c | 2 +- .../port/esp8266/include/freertos/FreeRTOSConfig.h | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index 61e961d8..d8141f8a 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -32,6 +32,18 @@ config FREERTOS_MAX_HOOK help configurate the max number of FreeRTOS hook function. +config FREERTOS_IDLE_TASK_STACKSIZE + int "Idle Task stack size" + range 1024 32768 + default 1024 + help + The idle task has its own stack, sized in bytes. The default size is enough for most uses. Size can be reduced + to 1024 bytes if no (or simple) FreeRTOS idle hooks are used and pthread local storage or FreeRTOS local storage + cleanup callbacks are not used. + + The stack size may need to be increased above the default if the app installs idle or thread local storage + cleanup hooks that use a lot of stack memory. + config FREERTOS_ISR_STACKSIZE int "ISR stack size" range 512 8192 diff --git a/components/freertos/freertos/tasks.c b/components/freertos/freertos/tasks.c index 2beb9ac9..68cd1539 100644 --- a/components/freertos/freertos/tasks.c +++ b/components/freertos/freertos/tasks.c @@ -1959,7 +1959,7 @@ BaseType_t xReturn; /* The Idle task is being created using dynamically allocated RAM. */ xReturn = xTaskCreate( prvIdleTask, configIDLE_TASK_NAME, - configMINIMAL_STACK_SIZE, + configIDLE_TASK_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */ diff --git a/components/freertos/port/esp8266/include/freertos/FreeRTOSConfig.h b/components/freertos/port/esp8266/include/freertos/FreeRTOSConfig.h index 81396405..a971d282 100644 --- a/components/freertos/port/esp8266/include/freertos/FreeRTOSConfig.h +++ b/components/freertos/port/esp8266/include/freertos/FreeRTOSConfig.h @@ -172,5 +172,9 @@ uint32_t esp_get_time(void); #define traceINCREASE_TICK_COUNT(_ticks) esp_increase_tick_cnt(_ticks) +#ifndef configIDLE_TASK_STACK_SIZE +#define configIDLE_TASK_STACK_SIZE CONFIG_FREERTOS_IDLE_TASK_STACKSIZE +#endif /* configIDLE_TASK_STACK_SIZE */ + #endif /* FREERTOS_CONFIG_H */