Merge branch 'feature/freertos_kconfig' into 'master'

freertos kconfig: Add max task length name, move task stack overflow watchpoint

* Allow setting task name length via kconfig
* Move task stack overflow watchpoint out of internals debugging submenu, place next to other stack overflow checks.
* Thread local pointer feature should depend on Ethernet or WiFi

See merge request !531
This commit is contained in:
Ivan Grokhotkov 2017-03-03 11:29:05 +08:00
commit 7a186ba1b0
2 changed files with 39 additions and 23 deletions

View File

@ -76,17 +76,38 @@ config FREERTOS_CHECK_STACKOVERFLOW_CANARY
(configCHECK_FOR_STACK_OVERFLOW=2)
endchoice
config FREERTOS_WATCHPOINT_END_OF_STACK
bool "Set a debug watchpoint as a stack overflow check"
default n
help
FreeRTOS can check if a stack has overflown its bounds by checking either the value of
the stack pointer or by checking the integrity of canary bytes. (See FREERTOS_CHECK_STACKOVERFLOW
for more information.) These checks only happen on a context switch, and the situation that caused
the stack overflow may already be long gone by then. This option will use the debug memory
watchpoint 1 (the second one) to allow breaking into the debugger (or panic'ing) as soon as any
of the last 32 bytes on the stack of a task are overwritten. The side effect is that using gdb, you
effectively only have one watchpoint; the 2nd one is overwritten as soon as a task switch happens.
This check only triggers if the stack overflow writes within 4 bytes of the end of the stack, rather than
overshooting further, so it is worth combining this approach with one of the other stack overflow check methods.
When this watchpoint is hit, gdb will stop with a SIGTRAP message. When no OCD is attached, esp-idf
will panic on an unhandled debug exception.
config FREERTOS_THREAD_LOCAL_STORAGE_POINTERS
int "Amount of thread local storage pointers"
range 0 256 if !WIFI_ENABLED
range 1 256 if WIFI_ENABLED
int "Number of thread local storage pointers"
range 0 256 if !(WIFI_ENABLED || ETHERNET)
range 1 256 if WIFI_ENABLED || ETHERNET
default 1
help
FreeRTOS has the ability to store per-thread pointers in the task
control block. This controls the amount of pointers available;
0 turns off this functionality.
control block. This controls the number of pointers available.
If using the WiFi stack, this value must be at least 1.
Value 0 turns off this functionality.
If using the LWIP TCP/IP stack (with WiFi or Ethernet), this value must be at least 1. See the
LWIP_THREAD_LOCAL_STORAGE_INDEX config item in LWIP configuration to determine which thread-local-storage
pointer is reserved for LWIP.
choice FREERTOS_ASSERT
prompt "FreeRTOS assertions"
@ -164,6 +185,17 @@ config FREERTOS_LEGACY_TICK_HOOK
endif #FREERTOS_LEGACY_HOOKS
config FREERTOS_MAX_TASK_NAME_LEN
int "Maximum task name length"
range 1 256
default 16
help
Changes the maximum task name length. Each task allocated will
include this many bytes for a task name. Using a shorter value
saves a small amount of RAM, a longer value allows more complex
names.
For most uses, the default of 16 is OK.
menuconfig FREERTOS_DEBUG_INTERNALS
bool "Debug FreeRTOS internals"
@ -192,22 +224,6 @@ config FREERTOS_PORTMUX_DEBUG_RECURSIVE
portMUX usage.
endif #FREERTOS_UNICORE
config FREERTOS_WATCHPOINT_END_OF_STACK
bool "Set a debug watchpoint at the end of each stack"
default n
help
FreeRTOS can check if a stack has overflown its bounds by checking either the value of
the stack pointer or by checking the integrity of canary bytes. (See FREERTOS_CHECK_STACKOVERFLOW
for more information.) These checks only happen on a context switch, and the situation that caused
the stack overflow may already be long gone by then. This option will use the debug memory
watchpoint 1 (the second one) to allow breaking into the debugger (or panic'ing) as soon as any
of the last 32 bytes on the stack of a task are overwritten. The side effect is that using gdb, you
effectively only have one watchpoint; the 2nd one is overwritten as soon as a task switch happens.
When this watchpoint is hit, gdb will stop with a SIGTRAP message. When no OCD is attached, esp-idf
will panic on an unhandled debug exception.
endif # FREERTOS_DEBUG_INTERNALS
endmenu

View File

@ -187,7 +187,7 @@
#define configAPPLICATION_ALLOCATED_HEAP 1
#define configTOTAL_HEAP_SIZE (&_heap_end - &_heap_start)//( ( size_t ) (64 * 1024) )
#define configMAX_TASK_NAME_LEN ( 16 )
#define configMAX_TASK_NAME_LEN ( CONFIG_FREERTOS_MAX_TASK_NAME_LEN )
#define configUSE_TRACE_FACILITY 0 /* Used by vTaskList in main.c */
#define configUSE_STATS_FORMATTING_FUNCTIONS 0 /* Used by vTaskList in main.c */
#define configUSE_TRACE_FACILITY_2 0 /* Provided by Xtensa port patch */