Преглед на файлове

freertos: increase configMINIMAL_STACK_SIZE when building with -O0

FreeRTOS scheduler uses additional stack space, as in some functions
variables are placed onto the stack instead of registers.

This issue resulted in occasional stack overflows in dport task, when
compiling at -O0 optimization level.

- Increase the configMINIMAL_STACK_SIZE to 1kB.
- Enable the watchpoint at the end of stack in CI startup test for
  this optimization level.
Ivan Grokhotkov преди 5 години
родител
ревизия
f4ea9d4cea
променени са 2 файла, в които са добавени 7 реда и са изтрити 3 реда
  1. 6 3
      components/freertos/xtensa/include/freertos/FreeRTOSConfig.h
  2. 1 0
      tools/test_apps/system/startup/sdkconfig.ci.opt_o0

+ 6 - 3
components/freertos/xtensa/include/freertos/FreeRTOSConfig.h

@@ -181,11 +181,14 @@ int xt_clock_freq(void) __attribute__((deprecated));
 #define configMAX_PRIORITIES			( 25 )
 #endif
 
-#ifndef CONFIG_APPTRACE_ENABLE
-#define configMINIMAL_STACK_SIZE		768
-#else
+#if defined(CONFIG_APPTRACE_ENABLE)
 /* apptrace module requires at least 2KB of stack per task */
 #define configMINIMAL_STACK_SIZE		2048
+#elif defined(CONFIG_COMPILER_OPTIMIZATION_NONE)
+/* with optimizations disabled, scheduler uses additional stack */
+#define configMINIMAL_STACK_SIZE		1024
+#else
+#define configMINIMAL_STACK_SIZE		768
 #endif
 
 #ifndef configIDLE_TASK_STACK_SIZE

+ 1 - 0
tools/test_apps/system/startup/sdkconfig.ci.opt_o0

@@ -1 +1,2 @@
 CONFIG_COMPILER_OPTIMIZATION_NONE=y
+CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y