Selaa lähdekoodia

Merge branch 'bugfix/minimal_stack_size' into 'master'

freertos: Bump idle stack size to 1KB, min stack to 768 bytes, make configurable

See merge request !979

Angus Gratton 8 vuotta sitten
vanhempi
sitoutus
9487797273

+ 9 - 0
components/freertos/Kconfig

@@ -149,6 +149,15 @@ menuconfig ENABLE_MEMORY_DEBUG
     help
         Enable this option to show malloc heap block and memory crash detect
 
+config FREERTOS_IDLE_TASK_STACKSIZE
+    int "Idle Task stack size"
+    range 768 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 768 bytes if no (or simple) FreeRTOS idle hooks are used. The stack size may need to be increased above the
+        default if the app installs idle hooks that use a lot of stack memory.
+
 config FREERTOS_ISR_STACKSIZE
     int "ISR stack size"
     range 1536 32768

+ 5 - 1
components/freertos/include/freertos/FreeRTOSConfig.h

@@ -164,12 +164,16 @@
 #endif
 
 #ifndef CONFIG_ESP32_APPTRACE_ENABLE
-#define configMINIMAL_STACK_SIZE		512
+#define configMINIMAL_STACK_SIZE		768
 #else
 /* apptrace module requires at least 2KB of stack per task */
 #define configMINIMAL_STACK_SIZE		2048
 #endif
 
+#ifndef configIDLE_TASK_STACK_SIZE
+#define configIDLE_TASK_STACK_SIZE CONFIG_FREERTOS_IDLE_TASK_STACKSIZE
+#endif
+
 /* The Xtensa port uses a separate interrupt stack. Adjust the stack size */
 /* to suit the needs of your specific application.                        */
 #ifndef configISR_STACK_SIZE

+ 2 - 2
components/freertos/tasks.c

@@ -112,9 +112,9 @@ functions but without including stdio.h here. */
 #endif /* configUSE_TICKLESS_IDLE */
 
 /*
- * Defines the size, in words, of the stack allocated to the idle task.
+ * Defines the size, in bytes, of the stack allocated to the idle task.
  */
-#define tskIDLE_STACK_SIZE	configMINIMAL_STACK_SIZE
+#define tskIDLE_STACK_SIZE	configIDLE_TASK_STACK_SIZE
 
 #if( configUSE_PREEMPTION == 0 )
 	/* If the cooperative scheduler is being used then a yield should not be