Kconfig 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. menu "FreeRTOS"
  2. # This is actually also handled in the ESP32 startup code, not only in FreeRTOS.
  3. config FREERTOS_UNICORE
  4. bool "Run FreeRTOS only on first core"
  5. default n
  6. help
  7. This version of FreeRTOS normally takes control of all cores of
  8. the CPU. Select this if you only want to start it on the first core.
  9. This is needed when e.g. another process needs complete control
  10. over the second core.
  11. # This invisible config value sets the value of tskNO_AFFINITY in task.h.
  12. # Intended to be used as a constant from other Kconfig files.
  13. # Value is (32-bit) INT_MAX.
  14. config FREERTOS_NO_AFFINITY
  15. hex
  16. default 0x7FFFFFFF
  17. choice FREERTOS_CORETIMER
  18. prompt "Xtensa timer to use as the FreeRTOS tick source"
  19. default CONFIG_FREERTOS_CORETIMER_0
  20. help
  21. FreeRTOS needs a timer with an associated interrupt to use as
  22. the main tick source to increase counters, run timers and do
  23. pre-emptive multitasking with. There are multiple timers available
  24. to do this, with different interrupt priorities. Check
  25. config FREERTOS_CORETIMER_0
  26. bool "Timer 0 (int 6, level 1)"
  27. help
  28. Select this to use timer 0
  29. config FREERTOS_CORETIMER_1
  30. bool "Timer 1 (int 15, level 3)"
  31. help
  32. Select this to use timer 1
  33. endchoice
  34. config FREERTOS_HZ
  35. int "Tick rate (Hz)"
  36. range 1 1000
  37. default 100
  38. help
  39. Select the tick rate at which FreeRTOS does pre-emptive context switching.
  40. config FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
  41. bool "Halt when an SMP-untested function is called"
  42. default y
  43. help
  44. Some functions in FreeRTOS have not been thoroughly tested yet when moving to
  45. the SMP implementation of FreeRTOS. When this option is enabled, these fuctions
  46. will throw an assert().
  47. choice FREERTOS_CHECK_STACKOVERFLOW
  48. prompt "Check for stack overflow"
  49. default FREERTOS_CHECK_STACKOVERFLOW_CANARY
  50. help
  51. FreeRTOS can check for stack overflows in threads and trigger an user function
  52. called vApplicationStackOverflowHook when this happens.
  53. config FREERTOS_CHECK_STACKOVERFLOW_NONE
  54. bool "No checking"
  55. help
  56. Do not check for stack overflows (configCHECK_FOR_STACK_OVERFLOW=0)
  57. config FREERTOS_CHECK_STACKOVERFLOW_PTRVAL
  58. bool "Check by stack pointer value"
  59. help
  60. Check for stack overflows on each context switch by checking if
  61. the stack pointer is in a valid range. Quick but does not detect
  62. stack overflows that happened between context switches
  63. (configCHECK_FOR_STACK_OVERFLOW=1)
  64. config FREERTOS_CHECK_STACKOVERFLOW_CANARY
  65. bool "Check using canary bytes"
  66. help
  67. Places some magic bytes at the end of the stack area and on each
  68. context switch, check if these bytes are still intact. More thorough
  69. than just checking the pointer, but also slightly slower.
  70. (configCHECK_FOR_STACK_OVERFLOW=2)
  71. endchoice
  72. config FREERTOS_WATCHPOINT_END_OF_STACK
  73. bool "Set a debug watchpoint as a stack overflow check"
  74. default n
  75. help
  76. FreeRTOS can check if a stack has overflown its bounds by checking either the value of
  77. the stack pointer or by checking the integrity of canary bytes. (See FREERTOS_CHECK_STACKOVERFLOW
  78. for more information.) These checks only happen on a context switch, and the situation that caused
  79. the stack overflow may already be long gone by then. This option will use the debug memory
  80. watchpoint 1 (the second one) to allow breaking into the debugger (or panic'ing) as soon as any
  81. of the last 32 bytes on the stack of a task are overwritten. The side effect is that using gdb, you
  82. effectively only have one watchpoint; the 2nd one is overwritten as soon as a task switch happens.
  83. This check only triggers if the stack overflow writes within 4 bytes of the end of the stack, rather than
  84. overshooting further, so it is worth combining this approach with one of the other stack overflow check
  85. methods.
  86. When this watchpoint is hit, gdb will stop with a SIGTRAP message. When no JTAG OCD is attached, esp-idf
  87. will panic on an unhandled debug exception.
  88. config FREERTOS_INTERRUPT_BACKTRACE
  89. bool "Enable backtrace from interrupt to task context"
  90. default y
  91. help
  92. If this option is enabled, interrupt stack frame will be modified to
  93. point to the code of the interrupted task as its return address.
  94. This helps the debugger (or the panic handler) show a backtrace from
  95. the interrupt to the task which was interrupted. This also works for
  96. nested interrupts: higer level interrupt stack can be traced back to the
  97. lower level interrupt.
  98. This option adds 4 instructions to the interrupt dispatching code.
  99. config FREERTOS_THREAD_LOCAL_STORAGE_POINTERS
  100. int "Number of thread local storage pointers"
  101. range 1 256
  102. default 1
  103. help
  104. FreeRTOS has the ability to store per-thread pointers in the task
  105. control block. This controls the number of pointers available.
  106. This value must be at least 1. Index 0 is reserved for use by the pthreads API
  107. thread-local-storage. Other indexes can be used for any desired purpose.
  108. choice FREERTOS_ASSERT
  109. prompt "FreeRTOS assertions"
  110. default FREERTOS_ASSERT_FAIL_ABORT
  111. help
  112. Failed FreeRTOS configASSERT() assertions can be configured to
  113. behave in different ways.
  114. config FREERTOS_ASSERT_FAIL_ABORT
  115. bool "abort() on failed assertions"
  116. help
  117. If a FreeRTOS configASSERT() fails, FreeRTOS will abort() and
  118. halt execution. The panic handler can be configured to handle
  119. the outcome of an abort() in different ways.
  120. config FREERTOS_ASSERT_FAIL_PRINT_CONTINUE
  121. bool "Print and continue failed assertions"
  122. help
  123. If a FreeRTOS assertion fails, print it out and continue.
  124. config FREERTOS_ASSERT_DISABLE
  125. bool "Disable FreeRTOS assertions"
  126. help
  127. FreeRTOS configASSERT() will not be compiled into the binary.
  128. endchoice
  129. config FREERTOS_IDLE_TASK_STACKSIZE
  130. int "Idle Task stack size"
  131. range 768 32768
  132. default 1536
  133. help
  134. The idle task has its own stack, sized in bytes. The default size is enough for most uses. Size can be
  135. reduced to 768 bytes if no (or simple) FreeRTOS idle hooks are used and pthread local storage or FreeRTOS
  136. local storage cleanup callbacks are not used.
  137. The stack size may need to be increased above the default if the app installs idle or thread local storage
  138. cleanup hooks that use a lot of stack memory.
  139. config FREERTOS_ISR_STACKSIZE
  140. int "ISR stack size"
  141. range 1536 32768
  142. default 1536
  143. help
  144. The interrupt handlers have their own stack. The size of the stack can be defined here.
  145. Each processor has its own stack, so the total size occupied will be twice this.
  146. config FREERTOS_LEGACY_HOOKS
  147. bool "Use FreeRTOS legacy hooks"
  148. default n
  149. help
  150. FreeRTOS offers a number of hooks/callback functions that are called when a timer
  151. tick happens, the idle thread runs etc. esp-idf replaces these by runtime registerable
  152. hooks using the esp_register_freertos_xxx_hook system, but for legacy reasons the old
  153. hooks can also still be enabled. Please enable this only if you have code that for some
  154. reason can't be migrated to the esp_register_freertos_xxx_hook system.
  155. config FREERTOS_MAX_TASK_NAME_LEN
  156. int "Maximum task name length"
  157. range 1 256
  158. default 16
  159. help
  160. Changes the maximum task name length. Each task allocated will
  161. include this many bytes for a task name. Using a shorter value
  162. saves a small amount of RAM, a longer value allows more complex
  163. names.
  164. For most uses, the default of 16 is OK.
  165. config SUPPORT_STATIC_ALLOCATION
  166. bool "Enable FreeRTOS static allocation API"
  167. default n
  168. help
  169. FreeRTOS gives the application writer the ability to instead provide the memory
  170. themselves, allowing the following objects to optionally be created without any
  171. memory being allocated dynamically:
  172. - Tasks
  173. - Software Timers (Daemon task is still dynamic. See documentation)
  174. - Queues
  175. - Event Groups
  176. - Binary Semaphores
  177. - Counting Semaphores
  178. - Recursive Semaphores
  179. - Mutexes
  180. Whether it is preferable to use static or dynamic memory allocation is dependent on
  181. the application, and the preference of the application writer. Both methods have pros
  182. and cons, and both methods can be used within the same RTOS application.
  183. Creating RTOS objects using statically allocated RAM has the benefit of providing the application writer
  184. with more control: RTOS objects can be placed at specific memory locations. The maximum RAM footprint can
  185. be determined at link time, rather than run time. The application writer does not need to concern
  186. themselves with graceful handling of memory allocation failures. It allows the RTOS to be used in
  187. applications that simply don't allow any dynamic memory allocation (although FreeRTOS includes allocation
  188. schemes that can overcome most objections).
  189. config ENABLE_STATIC_TASK_CLEAN_UP_HOOK
  190. bool "Enable static task clean up hook"
  191. depends on SUPPORT_STATIC_ALLOCATION
  192. default n
  193. help
  194. Enable this option to make FreeRTOS call the static task clean up hook when a task is deleted.
  195. Bear in mind that if this option is enabled you will need to implement the following function::
  196. void vPortCleanUpTCB ( void *pxTCB ) {
  197. // place clean up code here
  198. }
  199. config TIMER_TASK_PRIORITY
  200. int "FreeRTOS timer task priority"
  201. range 1 25
  202. default 1
  203. help
  204. The timer service task (primarily) makes use of existing FreeRTOS features, allowing timer
  205. functionality to be added to an application with minimal impact on the size of the application's
  206. executable binary.
  207. Use this constant to define the priority that the timer task will run at.
  208. config TIMER_TASK_STACK_DEPTH
  209. int "FreeRTOS timer task stack size"
  210. range 1536 32768
  211. default 2048
  212. help
  213. The timer service task (primarily) makes use of existing FreeRTOS features, allowing timer
  214. functionality to be added to an application with minimal impact on the size of the application's
  215. executable binary.
  216. Use this constant to define the size (in bytes) of the stack allocated for the timer task.
  217. config TIMER_QUEUE_LENGTH
  218. int "FreeRTOS timer queue length"
  219. range 5 20
  220. default 10
  221. help
  222. FreeRTOS provides a set of timer related API functions. Many of these functions use a standard
  223. FreeRTOS queue to send commands to the timer service task. The queue used for this purpose is
  224. called the 'timer command queue'. The 'timer command queue' is private to the FreeRTOS timer
  225. implementation, and cannot be accessed directly.
  226. For most uses the default value of 10 is OK.
  227. config FREERTOS_QUEUE_REGISTRY_SIZE
  228. int "FreeRTOS queue registry size"
  229. range 0 20
  230. default 0
  231. help
  232. FreeRTOS uses the queue registry as a means for kernel aware debuggers to locate queues, semaphores,
  233. and mutexes. The registry allows for a textual name to be associated with a queue for easy identification
  234. within a debugging GUI. A value of 0 will disable queue registry functionality, and a value larger than 0
  235. will specify the number of queues/semaphores/mutexes that the registry can hold.
  236. config FREERTOS_USE_TRACE_FACILITY
  237. bool "Enable FreeRTOS trace facility"
  238. default n
  239. help
  240. If enabled, configUSE_TRACE_FACILITY will be defined as 1 in FreeRTOS.
  241. This will allow the usage of trace facility functions such as
  242. uxTaskGetSystemState().
  243. config FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
  244. bool "Enable FreeRTOS stats formatting functions"
  245. depends on FREERTOS_USE_TRACE_FACILITY
  246. default n
  247. help
  248. If enabled, configUSE_STATS_FORMATTING_FUNCTIONS will be defined as 1 in
  249. FreeRTOS. This will allow the usage of stats formatting functions such
  250. as vTaskList().
  251. config FREERTOS_VTASKLIST_INCLUDE_COREID
  252. bool "Enable display of xCoreID in vTaskList"
  253. depends on FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
  254. default n
  255. help
  256. If enabled, this will include an extra column when vTaskList is called
  257. to display the CoreID the task is pinned to (0,1) or -1 if not pinned.
  258. config FREERTOS_GENERATE_RUN_TIME_STATS
  259. bool "Enable FreeRTOS to collect run time stats"
  260. default n
  261. select FREERTOS_USE_TRACE_FACILITY
  262. select FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
  263. help
  264. If enabled, configGENERATE_RUN_TIME_STATS will be defined as 1 in
  265. FreeRTOS. This will allow FreeRTOS to collect information regarding the
  266. usage of processor time amongst FreeRTOS tasks. Run time stats are
  267. generated using either the ESP Timer or the CPU Clock as the clock
  268. source (Note that run time stats are only valid until the clock source
  269. overflows). The function vTaskGetRunTimeStats() will also be available
  270. if FREERTOS_USE_STATS_FORMATTING_FUNCTIONS and
  271. FREERTOS_USE_TRACE_FACILITY are enabled. vTaskGetRunTimeStats() will
  272. display the run time of each task as a % of the total run time of all
  273. CPUs (task run time / no of CPUs) / (total run time / 100 )
  274. choice FREERTOS_RUN_TIME_STATS_CLK
  275. prompt "Choose the clock source for run time stats"
  276. depends on FREERTOS_GENERATE_RUN_TIME_STATS
  277. default FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
  278. help
  279. Choose the clock source for FreeRTOS run time stats. Options are CPU0's
  280. CPU Clock or the ESP Timer. Both clock sources are 32 bits. The CPU
  281. Clock can run at a higher frequency hence provide a finer resolution
  282. but will overflow much quicker. Note that run time stats are only valid
  283. until the clock source overflows.
  284. config FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
  285. bool "Use ESP TIMER for run time stats"
  286. help
  287. ESP Timer will be used as the clock source for FreeRTOS run time stats.
  288. The ESP Timer runs at a frequency of 1MHz regardless of Dynamic
  289. Frequency Scaling. Therefore the ESP Timer will overflow in
  290. approximately 4290 seconds.
  291. config FREERTOS_RUN_TIME_STATS_USING_CPU_CLK
  292. bool "Use CPU Clock for run time stats"
  293. help
  294. CPU Clock will be used as the clock source for the generation of run
  295. time stats. The CPU Clock has a frequency dependent on
  296. ESP32_DEFAULT_CPU_FREQ_MHZ and Dynamic Frequency Scaling (DFS).
  297. Therefore the CPU Clock frequency can fluctuate between 80 to 240MHz.
  298. Run time stats generated using the CPU Clock represents the number of
  299. CPU cycles each task is allocated and DOES NOT reflect the amount of
  300. time each task runs for (as CPU clock frequency can change). If the CPU
  301. clock consistently runs at the maximum frequency of 240MHz, it will
  302. overflow in approximately 17 seconds.
  303. endchoice
  304. config FREERTOS_USE_TICKLESS_IDLE
  305. bool "Tickless idle support"
  306. depends on PM_ENABLE
  307. default n
  308. help
  309. If power management support is enabled, FreeRTOS will be able to put
  310. the system into light sleep mode when no tasks need to run for a number
  311. of ticks. This number can be set using FREERTOS_IDLE_TIME_BEFORE_SLEEP option.
  312. This feature is also known as "automatic light sleep".
  313. Note that timers created using esp_timer APIs may prevent the system from
  314. entering sleep mode, even when no tasks need to run.
  315. If disabled, automatic light sleep support will be disabled.
  316. config FREERTOS_IDLE_TIME_BEFORE_SLEEP
  317. int "Minimum number of ticks to enter sleep mode for"
  318. depends on FREERTOS_USE_TICKLESS_IDLE
  319. default 3
  320. range 2 4294967295
  321. # Minimal value is 2 because of a check in FreeRTOS.h (search configEXPECTED_IDLE_TIME_BEFORE_SLEEP)
  322. help
  323. FreeRTOS will enter light sleep mode if no tasks need to run for this number
  324. of ticks.
  325. menuconfig FREERTOS_DEBUG_INTERNALS
  326. bool "Debug FreeRTOS internals"
  327. default n
  328. help
  329. Enable this option to show the menu with internal FreeRTOS debugging features.
  330. This option does not change any code by itself, it just shows/hides some options.
  331. if FREERTOS_DEBUG_INTERNALS
  332. config FREERTOS_PORTMUX_DEBUG
  333. bool "Debug portMUX portENTER_CRITICAL/portEXIT_CRITICAL"
  334. depends on FREERTOS_DEBUG_INTERNALS
  335. default n
  336. help
  337. If enabled, debug information (including integrity checks) will be printed
  338. to UART for the port-specific MUX implementation.
  339. if !FREERTOS_UNICORE
  340. config FREERTOS_PORTMUX_DEBUG_RECURSIVE
  341. bool "Debug portMUX Recursion"
  342. depends on FREERTOS_PORTMUX_DEBUG
  343. default n
  344. help
  345. If enabled, additional debug information will be printed for recursive
  346. portMUX usage.
  347. endif #FREERTOS_UNICORE
  348. endif # FREERTOS_DEBUG_INTERNALS
  349. config FREERTOS_TASK_FUNCTION_WRAPPER
  350. bool "Enclose all task functions in a wrapper function"
  351. depends on OPTIMIZATION_LEVEL_DEBUG
  352. default y
  353. help
  354. If enabled, all FreeRTOS task functions will be enclosed in a wrapper function.
  355. If a task function mistakenly returns (i.e. does not delete), the call flow will
  356. return to the wrapper function. The wrapper function will then log an error and
  357. abort the application. This option is also required for GDB backtraces and C++
  358. exceptions to work correctly inside top-level task functions.
  359. config FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER
  360. bool "Check that mutex semaphore is given by owner task"
  361. default y
  362. help
  363. If enabled, assert that when a mutex semaphore is given, the task giving the
  364. semaphore is the task which is currently holding the mutex.
  365. config FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE
  366. bool "Tests compliance with Vanilla FreeRTOS port*_CRITICAL calls"
  367. default n
  368. help
  369. If enabled, context of port*_CRITICAL calls (ISR or Non-ISR)
  370. would be checked to be in compliance with Vanilla FreeRTOS.
  371. e.g Calling port*_CRITICAL from ISR context would cause assert failure
  372. endmenu