mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
freertos: Increase minimum task stack size when stack smashing checker is enabled
Fixes issue with DPORT init task, this task uses minimum stack size and may not be enough if stack smashing detection is set to Overall mode. Also reworks the way we calculate minimum stack to allow for adding multiple contributing factors. Closes https://github.com/espressif/esp-idf/issues/6403
This commit is contained in:
parent
41efdb0b34
commit
f24e1f5601
@ -175,6 +175,9 @@ static void dport_access_init_core(void *arg)
|
||||
dport_access_end[core_id] = 0;
|
||||
dport_core_state[core_id] = DPORT_CORE_STATE_RUNNING;
|
||||
|
||||
/* If this fails then the minimum stack size for this config is too close to running out */
|
||||
assert(uxTaskGetStackHighWaterMark(NULL) > 128);
|
||||
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
#endif
|
||||
|
@ -76,7 +76,7 @@
|
||||
/* ESP31 and ESP32 are dualcore processors. */
|
||||
#ifndef CONFIG_FREERTOS_UNICORE
|
||||
#define portNUM_PROCESSORS 2
|
||||
#else
|
||||
#else
|
||||
#define portNUM_PROCESSORS 1
|
||||
#endif
|
||||
|
||||
@ -155,7 +155,7 @@ int xt_clock_freq(void) __attribute__((deprecated));
|
||||
* memory.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
@ -174,13 +174,37 @@ int xt_clock_freq(void) __attribute__((deprecated));
|
||||
#define configMAX_PRIORITIES ( 25 )
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ESP32_APPTRACE_ENABLE
|
||||
#define configMINIMAL_STACK_SIZE 768
|
||||
/* Various things that impact minimum stack sizes */
|
||||
|
||||
/* Higher stack checker modes cause overhead on each function call */
|
||||
#if CONFIG_STACK_CHECK_ALL || CONFIG_STACK_CHECK_STRONG
|
||||
#define configSTACK_OVERHEAD_CHECKER 256
|
||||
#else
|
||||
/* apptrace module requires at least 2KB of stack per task */
|
||||
#define configMINIMAL_STACK_SIZE 2048
|
||||
#define configSTACK_OVERHEAD_CHECKER 0
|
||||
#endif
|
||||
|
||||
/* with optimizations disabled, scheduler uses additional stack */
|
||||
#if CONFIG_COMPILER_OPTIMIZATION_NONE
|
||||
#define configSTACK_OVERHEAD_OPTIMIZATION 256
|
||||
#else
|
||||
#define configSTACK_OVERHEAD_OPTIMIZATION 0
|
||||
#endif
|
||||
|
||||
/* apptrace mdule increases minimum stack usage */
|
||||
#if CONFIG_APPTRACE_ENABLE
|
||||
#define configSTACK_OVERHEAD_APPTRACE 1280
|
||||
#else
|
||||
#define configSTACK_OVERHEAD_APPTRACE 0
|
||||
#endif
|
||||
|
||||
#define configSTACK_OVERHEAD_TOTAL ( \
|
||||
configSTACK_OVERHEAD_CHECKER + \
|
||||
configSTACK_OVERHEAD_OPTIMIZATION + \
|
||||
configSTACK_OVERHEAD_APPTRACE \
|
||||
)
|
||||
|
||||
#define configMINIMAL_STACK_SIZE (768 + configSTACK_OVERHEAD_TOTAL)
|
||||
|
||||
#ifndef configIDLE_TASK_STACK_SIZE
|
||||
#define configIDLE_TASK_STACK_SIZE CONFIG_FREERTOS_IDLE_TASK_STACKSIZE
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user