Kconfig 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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 methods.
  85. When this watchpoint is hit, gdb will stop with a SIGTRAP message. When no JTAG OCD is attached, esp-idf
  86. will panic on an unhandled debug exception.
  87. config FREERTOS_INTERRUPT_BACKTRACE
  88. bool "Enable backtrace from interrupt to task context"
  89. default y
  90. help
  91. If this option is enabled, interrupt stack frame will be modified to
  92. point to the code of the interrupted task as its return address.
  93. This helps the debugger (or the panic handler) show a backtrace from
  94. the interrupt to the task which was interrupted. This also works for
  95. nested interrupts: higer level interrupt stack can be traced back to the
  96. lower level interrupt.
  97. This option adds 4 instructions to the interrupt dispatching code.
  98. config FREERTOS_THREAD_LOCAL_STORAGE_POINTERS
  99. int "Number of thread local storage pointers"
  100. range 1 256
  101. default 1
  102. help
  103. FreeRTOS has the ability to store per-thread pointers in the task
  104. control block. This controls the number of pointers available.
  105. This value must be at least 1. Index 0 is reserved for use by the pthreads API
  106. thread-local-storage. Other indexes can be used for any desired purpose.
  107. choice FREERTOS_ASSERT
  108. prompt "FreeRTOS assertions"
  109. default FREERTOS_ASSERT_FAIL_ABORT
  110. help
  111. Failed FreeRTOS configASSERT() assertions can be configured to
  112. behave in different ways.
  113. config FREERTOS_ASSERT_FAIL_ABORT
  114. bool "abort() on failed assertions"
  115. help
  116. If a FreeRTOS configASSERT() fails, FreeRTOS will abort() and
  117. halt execution. The panic handler can be configured to handle
  118. the outcome of an abort() in different ways.
  119. config FREERTOS_ASSERT_FAIL_PRINT_CONTINUE
  120. bool "Print and continue failed assertions"
  121. help
  122. If a FreeRTOS assertion fails, print it out and continue.
  123. config FREERTOS_ASSERT_DISABLE
  124. bool "Disable FreeRTOS assertions"
  125. help
  126. FreeRTOS configASSERT() will not be compiled into the binary.
  127. endchoice
  128. config FREERTOS_IDLE_TASK_STACKSIZE
  129. int "Idle Task stack size"
  130. range 768 32768
  131. default 1536
  132. help
  133. The idle task has its own stack, sized in bytes. The default size is enough for most uses. Size can be reduced
  134. to 768 bytes if no (or simple) FreeRTOS idle hooks are used and pthread local storage or FreeRTOS local storage
  135. cleanup callbacks are not used.
  136. The stack size may need to be increased above the default if the app installs idle or thread local storage
  137. cleanup hooks that use a lot of stack memory.
  138. config FREERTOS_ISR_STACKSIZE
  139. int "ISR stack size"
  140. range 1536 32768
  141. default 1536
  142. help
  143. The interrupt handlers have their own stack. The size of the stack can be defined here.
  144. Each processor has its own stack, so the total size occupied will be twice this.
  145. config FREERTOS_LEGACY_HOOKS
  146. bool "Use FreeRTOS legacy hooks"
  147. default n
  148. help
  149. FreeRTOS offers a number of hooks/callback functions that are called when a timer
  150. tick happens, the idle thread runs etc. esp-idf replaces these by runtime registerable
  151. hooks using the esp_register_freertos_xxx_hook system, but for legacy reasons the old
  152. hooks can also still be enabled. Please enable this only if you have code that for some
  153. reason can't be migrated to the esp_register_freertos_xxx_hook system.
  154. config FREERTOS_MAX_TASK_NAME_LEN
  155. int "Maximum task name length"
  156. range 1 256
  157. default 16
  158. help
  159. Changes the maximum task name length. Each task allocated will
  160. include this many bytes for a task name. Using a shorter value
  161. saves a small amount of RAM, a longer value allows more complex
  162. names.
  163. For most uses, the default of 16 is OK.
  164. config SUPPORT_STATIC_ALLOCATION
  165. bool "Enable FreeRTOS static allocation API"
  166. default n
  167. help
  168. FreeRTOS gives the application writer the ability to instead provide the memory
  169. themselves, allowing the following objects to optionally be created without any
  170. memory being allocated dynamically:
  171. - Tasks
  172. - Software Timers (Daemon task is still dynamic. See documentation)
  173. - Queues
  174. - Event Groups
  175. - Binary Semaphores
  176. - Counting Semaphores
  177. - Recursive Semaphores
  178. - Mutexes
  179. Whether it is preferable to use static or dynamic memory allocation is dependent on
  180. the application, and the preference of the application writer. Both methods have pros
  181. and cons, and both methods can be used within the same RTOS application.
  182. Creating RTOS objects using statically allocated RAM has the benefit of providing the
  183. application writer with more control: RTOS objects can be placed at specific memory locations.
  184. The maximum RAM footprint can be determined at link time, rather than run time.
  185. The application writer does not need to concern themselves with graceful handling of memory allocation failures.
  186. It allows the RTOS to be used in applications that simply don't allow any dynamic memory allocation
  187. (although FreeRTOS includes allocation schemes that can overcome most objections).
  188. config ENABLE_STATIC_TASK_CLEAN_UP_HOOK
  189. bool "Enable static task clean up hook"
  190. depends on SUPPORT_STATIC_ALLOCATION
  191. default n
  192. help
  193. Enable this option to make FreeRTOS call the static task clean up hook when a task is deleted.
  194. Bear in mind that if this option is enabled you will need to implement the following function::
  195. void vPortCleanUpTCB ( void *pxTCB ) {
  196. // place clean up code here
  197. }
  198. config TIMER_TASK_PRIORITY
  199. int "FreeRTOS timer task priority"
  200. range 1 25
  201. default 1
  202. help
  203. The timer service task (primarily) makes use of existing FreeRTOS features, allowing timer
  204. functionality to be added to an application with minimal impact on the size of the application's
  205. executable binary.
  206. Use this constant to define the priority that the timer task will run at.
  207. config TIMER_TASK_STACK_DEPTH
  208. int "FreeRTOS timer task stack size"
  209. range 1536 32768
  210. default 2048
  211. help
  212. The timer service task (primarily) makes use of existing FreeRTOS features, allowing timer
  213. functionality to be added to an application with minimal impact on the size of the application's
  214. executable binary.
  215. Use this constant to define the size (in bytes) of the stack allocated for the timer task.
  216. config TIMER_QUEUE_LENGTH
  217. int "FreeRTOS timer queue length"
  218. range 5 20
  219. default 10
  220. help
  221. FreeRTOS provides a set of timer related API functions. Many of these functions use a standard
  222. FreeRTOS queue to send commands to the timer service task. The queue used for this purpose is
  223. called the 'timer command queue'. The 'timer command queue' is private to the FreeRTOS timer
  224. implementation, and cannot be accessed directly.
  225. For most uses the default value of 10 is OK.
  226. config FREERTOS_QUEUE_REGISTRY_SIZE
  227. int "FreeRTOS queue registry size"
  228. range 0 20
  229. default 0
  230. help
  231. FreeRTOS uses the queue registry as a means for kernel aware debuggers to locate queues, semaphores,
  232. and mutexes. The registry allows for a textual name to be associated with a queue for easy identification
  233. within a debugging GUI. A value of 0 will disable queue registry functionality, and a value larger than 0
  234. will specify the number of queues/semaphores/mutexes that the registry can hold.
  235. config FREERTOS_USE_TRACE_FACILITY
  236. bool "Enable FreeRTOS trace facility"
  237. default n
  238. help
  239. If enabled, configUSE_TRACE_FACILITY will be defined as 1 in FreeRTOS.
  240. This will allow the usage of trace facility functions such as
  241. uxTaskGetSystemState().
  242. config FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
  243. bool "Enable FreeRTOS stats formatting functions"
  244. depends on FREERTOS_USE_TRACE_FACILITY
  245. default n
  246. help
  247. If enabled, configUSE_STATS_FORMATTING_FUNCTIONS will be defined as 1 in
  248. FreeRTOS. This will allow the usage of stats formatting functions such
  249. as vTaskList().
  250. config FREERTOS_VTASKLIST_INCLUDE_COREID
  251. bool "Enable display of xCoreID in vTaskList"
  252. depends on FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
  253. default n
  254. help
  255. If enabled, this will include an extra column when vTaskList is called
  256. to display the CoreID the task is pinned to (0,1) or -1 if not pinned.
  257. config FREERTOS_GENERATE_RUN_TIME_STATS
  258. bool "Enable FreeRTOS to collect run time stats"
  259. default n
  260. select FREERTOS_USE_TRACE_FACILITY
  261. select FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
  262. help
  263. If enabled, configGENERATE_RUN_TIME_STATS will be defined as 1 in
  264. FreeRTOS. This will allow FreeRTOS to collect information regarding the
  265. usage of processor time amongst FreeRTOS tasks. Run time stats are
  266. generated using either the ESP Timer or the CPU Clock as the clock
  267. source (Note that run time stats are only valid until the clock source
  268. overflows). The function vTaskGetRunTimeStats() will also be available
  269. if FREERTOS_USE_STATS_FORMATTING_FUNCTIONS and
  270. FREERTOS_USE_TRACE_FACILITY are enabled. vTaskGetRunTimeStats() will
  271. display the run time of each task as a % of the total run time of all
  272. CPUs (task run time / no of CPUs) / (total run time / 100 )
  273. choice FREERTOS_RUN_TIME_STATS_CLK
  274. prompt "Choose the clock source for run time stats"
  275. depends on FREERTOS_GENERATE_RUN_TIME_STATS
  276. default FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
  277. help
  278. Choose the clock source for FreeRTOS run time stats. Options are CPU0's
  279. CPU Clock or the ESP Timer. Both clock sources are 32 bits. The CPU
  280. Clock can run at a higher frequency hence provide a finer resolution
  281. but will overflow much quicker. Note that run time stats are only valid
  282. until the clock source overflows.
  283. config FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
  284. bool "Use ESP TIMER for run time stats"
  285. help
  286. ESP Timer will be used as the clock source for FreeRTOS run time stats.
  287. The ESP Timer runs at a frequency of 1MHz regardless of Dynamic
  288. Frequency Scaling. Therefore the ESP Timer will overflow in
  289. approximately 4290 seconds.
  290. config FREERTOS_RUN_TIME_STATS_USING_CPU_CLK
  291. bool "Use CPU Clock for run time stats"
  292. help
  293. CPU Clock will be used as the clock source for the generation of run
  294. time stats. The CPU Clock has a frequency dependent on
  295. ESP32_DEFAULT_CPU_FREQ_MHZ and Dynamic Frequency Scaling (DFS).
  296. Therefore the CPU Clock frequency can fluctuate between 80 to 240MHz.
  297. Run time stats generated using the CPU Clock represents the number of
  298. CPU cycles each task is allocated and DOES NOT reflect the amount of
  299. time each task runs for (as CPU clock frequency can change). If the CPU
  300. clock consistently runs at the maximum frequency of 240MHz, it will
  301. overflow in approximately 17 seconds.
  302. endchoice
  303. config FREERTOS_USE_TICKLESS_IDLE
  304. bool "Tickless idle support"
  305. depends on PM_ENABLE
  306. default n
  307. help
  308. If power management support is enabled, FreeRTOS will be able to put
  309. the system into light sleep mode when no tasks need to run for a number
  310. of ticks. This number can be set using FREERTOS_IDLE_TIME_BEFORE_SLEEP option.
  311. This feature is also known as "automatic light sleep".
  312. Note that timers created using esp_timer APIs may prevent the system from
  313. entering sleep mode, even when no tasks need to run.
  314. If disabled, automatic light sleep support will be disabled.
  315. config FREERTOS_IDLE_TIME_BEFORE_SLEEP
  316. int "Minimum number of ticks to enter sleep mode for"
  317. depends on FREERTOS_USE_TICKLESS_IDLE
  318. default 3
  319. range 2 4294967295
  320. # Minimal value is 2 because of a check in FreeRTOS.h (search configEXPECTED_IDLE_TIME_BEFORE_SLEEP)
  321. help
  322. FreeRTOS will enter light sleep mode if no tasks need to run for this number
  323. of ticks.
  324. menuconfig FREERTOS_DEBUG_INTERNALS
  325. bool "Debug FreeRTOS internals"
  326. default n
  327. help
  328. Enable this option to show the menu with internal FreeRTOS debugging features.
  329. This option does not change any code by itself, it just shows/hides some options.
  330. if FREERTOS_DEBUG_INTERNALS
  331. config FREERTOS_PORTMUX_DEBUG
  332. bool "Debug portMUX portENTER_CRITICAL/portEXIT_CRITICAL"
  333. depends on FREERTOS_DEBUG_INTERNALS
  334. default n
  335. help
  336. If enabled, debug information (including integrity checks) will be printed
  337. to UART for the port-specific MUX implementation.
  338. if !FREERTOS_UNICORE
  339. config FREERTOS_PORTMUX_DEBUG_RECURSIVE
  340. bool "Debug portMUX Recursion"
  341. depends on FREERTOS_PORTMUX_DEBUG
  342. default n
  343. help
  344. If enabled, additional debug information will be printed for recursive
  345. portMUX usage.
  346. endif #FREERTOS_UNICORE
  347. endif # FREERTOS_DEBUG_INTERNALS
  348. config FREERTOS_TASK_FUNCTION_WRAPPER
  349. bool "Enclose all task functions in a wrapper function"
  350. depends on OPTIMIZATION_LEVEL_DEBUG
  351. default y
  352. help
  353. If enabled, all FreeRTOS task functions will be enclosed in a wrapper function.
  354. If a task function mistakenly returns (i.e. does not delete), the call flow will
  355. return to the wrapper function. The wrapper function will then log an error and
  356. abort the application. This option is also required for GDB backtraces and C++
  357. exceptions to work correctly inside top-level task functions.
  358. endmenu