Kconfig 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. menu "FreeRTOS"
  2. config FREERTOS_UNICORE
  3. bool "Run FreeRTOS only on first core"
  4. default "y" if IDF_TARGET_ESP32S2
  5. select ESP_SYSTEM_SINGLE_CORE_MODE
  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. config FREERTOS_TICK_SUPPORT_CORETIMER
  18. bool
  19. default y if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2
  20. config FREERTOS_TICK_SUPPORT_SYSTIMER
  21. bool
  22. default y if !FREERTOS_TICK_SUPPORT_CORETIMER
  23. # ESP32-S3, ESP32-C3 and ESP32-H2 can use Systimer for FreeRTOS SysTick
  24. # ESP32S2 also has SYSTIMER but it can not be used for the FreeRTOS SysTick because:
  25. # - It has only one counter, which already in use esp_timer.
  26. # A counter for SysTick should be stall in debug mode but work esp_timer.
  27. # - It is not possible to allocate two handlers for esp_timer and SysTick.
  28. choice FREERTOS_CORETIMER
  29. prompt "Xtensa timer to use as the FreeRTOS tick source"
  30. default FREERTOS_CORETIMER_0 if FREERTOS_TICK_SUPPORT_CORETIMER
  31. default FREERTOS_CORETIMER_SYSTIMER_LVL1 if FREERTOS_TICK_SUPPORT_SYSTIMER
  32. help
  33. FreeRTOS needs a timer with an associated interrupt to use as
  34. the main tick source to increase counters, run timers and do
  35. pre-emptive multitasking with. There are multiple timers available
  36. to do this, with different interrupt priorities. Check
  37. config FREERTOS_CORETIMER_0
  38. bool "Timer 0 (int 6, level 1)"
  39. depends on FREERTOS_TICK_SUPPORT_CORETIMER
  40. help
  41. Select this to use timer 0
  42. config FREERTOS_CORETIMER_1
  43. bool "Timer 1 (int 15, level 3)"
  44. depends on FREERTOS_TICK_SUPPORT_CORETIMER
  45. help
  46. Select this to use timer 1
  47. config FREERTOS_CORETIMER_SYSTIMER_LVL1
  48. bool "SYSTIMER 0 (level 1)"
  49. depends on FREERTOS_TICK_SUPPORT_SYSTIMER
  50. help
  51. Select this to use systimer with the 1 interrupt priority.
  52. config FREERTOS_CORETIMER_SYSTIMER_LVL3
  53. bool "SYSTIMER 0 (level 3)"
  54. depends on FREERTOS_TICK_SUPPORT_SYSTIMER
  55. help
  56. Select this to use systimer with the 3 interrupt priority.
  57. endchoice
  58. config FREERTOS_SYSTICK_USES_SYSTIMER
  59. bool
  60. default y if FREERTOS_CORETIMER_SYSTIMER_LVL1 || FREERTOS_CORETIMER_SYSTIMER_LVL3
  61. config FREERTOS_SYSTICK_USES_CCOUNT
  62. bool
  63. default y if FREERTOS_CORETIMER_0 || FREERTOS_CORETIMER_1
  64. config FREERTOS_OPTIMIZED_SCHEDULER
  65. bool "Enable FreeRTOS pĺatform optimized scheduler"
  66. depends on FREERTOS_UNICORE
  67. default y
  68. help
  69. On most platforms there are instructions can speedup the ready task
  70. searching. Enabling this option the FreeRTOS with this instructions
  71. support will be built.
  72. config FREERTOS_HZ
  73. int "Tick rate (Hz)"
  74. range 1 1000
  75. default 100
  76. help
  77. Select the tick rate at which FreeRTOS does pre-emptive context switching.
  78. config FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
  79. bool "Halt when an SMP-untested function is called"
  80. default y
  81. help
  82. Some functions in FreeRTOS have not been thoroughly tested yet when moving to
  83. the SMP implementation of FreeRTOS. When this option is enabled, these fuctions
  84. will throw an assert().
  85. choice FREERTOS_CHECK_STACKOVERFLOW
  86. prompt "Check for stack overflow"
  87. default FREERTOS_CHECK_STACKOVERFLOW_CANARY
  88. help
  89. FreeRTOS can check for stack overflows in threads and trigger an user function
  90. called vApplicationStackOverflowHook when this happens.
  91. config FREERTOS_CHECK_STACKOVERFLOW_NONE
  92. bool "No checking"
  93. help
  94. Do not check for stack overflows (configCHECK_FOR_STACK_OVERFLOW=0)
  95. config FREERTOS_CHECK_STACKOVERFLOW_PTRVAL
  96. bool "Check by stack pointer value"
  97. help
  98. Check for stack overflows on each context switch by checking if
  99. the stack pointer is in a valid range. Quick but does not detect
  100. stack overflows that happened between context switches
  101. (configCHECK_FOR_STACK_OVERFLOW=1)
  102. config FREERTOS_CHECK_STACKOVERFLOW_CANARY
  103. bool "Check using canary bytes"
  104. help
  105. Places some magic bytes at the end of the stack area and on each
  106. context switch, check if these bytes are still intact. More thorough
  107. than just checking the pointer, but also slightly slower.
  108. (configCHECK_FOR_STACK_OVERFLOW=2)
  109. endchoice
  110. config FREERTOS_WATCHPOINT_END_OF_STACK
  111. bool "Set a debug watchpoint as a stack overflow check"
  112. default n
  113. help
  114. FreeRTOS can check if a stack has overflown its bounds by checking either the value of
  115. the stack pointer or by checking the integrity of canary bytes. (See FREERTOS_CHECK_STACKOVERFLOW
  116. for more information.) These checks only happen on a context switch, and the situation that caused
  117. the stack overflow may already be long gone by then. This option will use the last debug memory
  118. watchpoint to allow breaking into the debugger (or panic'ing) as soon as any
  119. of the last 32 bytes on the stack of a task are overwritten. The side effect is that using gdb, you
  120. effectively have one hardware watchpoint less because the last one is overwritten as soon as a task
  121. switch happens.
  122. Another consequence is that due to alignment requirements of the watchpoint, the usable stack size
  123. decreases by up to 60 bytes. This is because the watchpoint region has to be aligned to its size and the
  124. size for the stack watchpoint in IDF is 32 bytes.
  125. This check only triggers if the stack overflow writes within 32 bytes near the end of the stack, rather
  126. than overshooting further, so it is worth combining this approach with one of the other stack overflow
  127. check methods.
  128. When this watchpoint is hit, gdb will stop with a SIGTRAP message. When no JTAG OCD is attached, esp-idf
  129. will panic on an unhandled debug exception.
  130. config FREERTOS_INTERRUPT_BACKTRACE
  131. bool "Enable backtrace from interrupt to task context"
  132. default y
  133. help
  134. If this option is enabled, interrupt stack frame will be modified to
  135. point to the code of the interrupted task as its return address.
  136. This helps the debugger (or the panic handler) show a backtrace from
  137. the interrupt to the task which was interrupted. This also works for
  138. nested interrupts: higer level interrupt stack can be traced back to the
  139. lower level interrupt.
  140. This option adds 4 instructions to the interrupt dispatching code.
  141. config FREERTOS_THREAD_LOCAL_STORAGE_POINTERS
  142. int "Number of thread local storage pointers"
  143. range 1 256
  144. default 1
  145. help
  146. FreeRTOS has the ability to store per-thread pointers in the task
  147. control block. This controls the number of pointers available.
  148. This value must be at least 1. Index 0 is reserved for use by the pthreads API
  149. thread-local-storage. Other indexes can be used for any desired purpose.
  150. choice FREERTOS_ASSERT
  151. prompt "FreeRTOS assertions"
  152. default FREERTOS_ASSERT_FAIL_ABORT if !COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
  153. default FREERTOS_ASSERT_DISABLE if COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
  154. help
  155. Failed FreeRTOS configASSERT() assertions can be configured to
  156. behave in different ways.
  157. By default these behave the same as the global project assert settings.
  158. config FREERTOS_ASSERT_FAIL_ABORT
  159. bool "abort() on failed assertions"
  160. depends on !COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
  161. help
  162. If a FreeRTOS configASSERT() fails, FreeRTOS will abort() and
  163. halt execution. The panic handler can be configured to handle
  164. the outcome of an abort() in different ways.
  165. If assertions are disabled for the entire project, they are also
  166. disabled in FreeRTOS and this option is unavailable.
  167. config FREERTOS_ASSERT_FAIL_PRINT_CONTINUE
  168. bool "Print and continue failed assertions"
  169. help
  170. If a FreeRTOS assertion fails, print it out and continue.
  171. config FREERTOS_ASSERT_DISABLE
  172. bool "Disable FreeRTOS assertions"
  173. help
  174. FreeRTOS configASSERT() will not be compiled into the binary.
  175. endchoice
  176. config FREERTOS_IDLE_TASK_STACKSIZE
  177. int "Idle Task stack size"
  178. range 768 32768
  179. default 1536
  180. help
  181. The idle task has its own stack, sized in bytes. The default size is enough for most uses. Size can be
  182. reduced to 768 bytes if no (or simple) FreeRTOS idle hooks are used and pthread local storage or FreeRTOS
  183. local storage cleanup callbacks are not used.
  184. The stack size may need to be increased above the default if the app installs idle or thread local storage
  185. cleanup hooks that use a lot of stack memory.
  186. config FREERTOS_ISR_STACKSIZE
  187. int "ISR stack size"
  188. range 2096 32768 if ESP_COREDUMP_DATA_FORMAT_ELF
  189. default 2096 if ESP_COREDUMP_DATA_FORMAT_ELF
  190. range 1536 32768
  191. default 1536
  192. help
  193. The interrupt handlers have their own stack. The size of the stack can be defined here.
  194. Each processor has its own stack, so the total size occupied will be twice this.
  195. config FREERTOS_LEGACY_HOOKS
  196. bool "Use FreeRTOS legacy hooks"
  197. default n
  198. help
  199. FreeRTOS offers a number of hooks/callback functions that are called when a timer
  200. tick happens, the idle thread runs etc. esp-idf replaces these by runtime registerable
  201. hooks using the esp_register_freertos_xxx_hook system, but for legacy reasons the old
  202. hooks can also still be enabled. Please enable this only if you have code that for some
  203. reason can't be migrated to the esp_register_freertos_xxx_hook system.
  204. config FREERTOS_MAX_TASK_NAME_LEN
  205. int "Maximum task name length"
  206. range 1 256
  207. default 16
  208. help
  209. Changes the maximum task name length. Each task allocated will
  210. include this many bytes for a task name. Using a shorter value
  211. saves a small amount of RAM, a longer value allows more complex
  212. names.
  213. For most uses, the default of 16 is OK.
  214. config FREERTOS_SUPPORT_STATIC_ALLOCATION
  215. # Always enabled.
  216. # Kconfig option preserved for compatibility with code
  217. # which checked for CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION.
  218. bool
  219. default y
  220. config FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
  221. bool "Enable static task clean up hook"
  222. default n
  223. help
  224. Enable this option to make FreeRTOS call the static task clean up hook when a task is deleted.
  225. Bear in mind that if this option is enabled you will need to implement the following function::
  226. void vPortCleanUpTCB ( void *pxTCB ) {
  227. // place clean up code here
  228. }
  229. config FREERTOS_TIMER_TASK_PRIORITY
  230. int "FreeRTOS timer task priority"
  231. range 1 25
  232. default 1
  233. help
  234. The timer service task (primarily) makes use of existing FreeRTOS features, allowing timer
  235. functionality to be added to an application with minimal impact on the size of the application's
  236. executable binary.
  237. Use this constant to define the priority that the timer task will run at.
  238. config FREERTOS_TIMER_TASK_STACK_DEPTH
  239. int "FreeRTOS timer task stack size"
  240. range 1536 32768
  241. default 2048
  242. help
  243. The timer service task (primarily) makes use of existing FreeRTOS features, allowing timer
  244. functionality to be added to an application with minimal impact on the size of the application's
  245. executable binary.
  246. Use this constant to define the size (in bytes) of the stack allocated for the timer task.
  247. config FREERTOS_TIMER_QUEUE_LENGTH
  248. int "FreeRTOS timer queue length"
  249. range 5 20
  250. default 10
  251. help
  252. FreeRTOS provides a set of timer related API functions. Many of these functions use a standard
  253. FreeRTOS queue to send commands to the timer service task. The queue used for this purpose is
  254. called the 'timer command queue'. The 'timer command queue' is private to the FreeRTOS timer
  255. implementation, and cannot be accessed directly.
  256. For most uses the default value of 10 is OK.
  257. config FREERTOS_QUEUE_REGISTRY_SIZE
  258. int "FreeRTOS queue registry size"
  259. range 0 20
  260. default 0
  261. help
  262. FreeRTOS uses the queue registry as a means for kernel aware debuggers to locate queues, semaphores,
  263. and mutexes. The registry allows for a textual name to be associated with a queue for easy identification
  264. within a debugging GUI. A value of 0 will disable queue registry functionality, and a value larger than 0
  265. will specify the number of queues/semaphores/mutexes that the registry can hold.
  266. config FREERTOS_USE_TRACE_FACILITY
  267. bool "Enable FreeRTOS trace facility"
  268. default n
  269. help
  270. If enabled, configUSE_TRACE_FACILITY will be defined as 1 in FreeRTOS.
  271. This will allow the usage of trace facility functions such as
  272. uxTaskGetSystemState().
  273. config FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
  274. bool "Enable FreeRTOS stats formatting functions"
  275. depends on FREERTOS_USE_TRACE_FACILITY
  276. default n
  277. help
  278. If enabled, configUSE_STATS_FORMATTING_FUNCTIONS will be defined as 1 in
  279. FreeRTOS. This will allow the usage of stats formatting functions such
  280. as vTaskList().
  281. config FREERTOS_VTASKLIST_INCLUDE_COREID
  282. bool "Enable display of xCoreID in vTaskList"
  283. depends on FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
  284. default n
  285. help
  286. If enabled, this will include an extra column when vTaskList is called
  287. to display the CoreID the task is pinned to (0,1) or -1 if not pinned.
  288. config FREERTOS_GENERATE_RUN_TIME_STATS
  289. bool "Enable FreeRTOS to collect run time stats"
  290. default n
  291. select FREERTOS_USE_TRACE_FACILITY
  292. select FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
  293. help
  294. If enabled, configGENERATE_RUN_TIME_STATS will be defined as 1 in
  295. FreeRTOS. This will allow FreeRTOS to collect information regarding the
  296. usage of processor time amongst FreeRTOS tasks. Run time stats are
  297. generated using either the ESP Timer or the CPU Clock as the clock
  298. source (Note that run time stats are only valid until the clock source
  299. overflows). The function vTaskGetRunTimeStats() will also be available
  300. if FREERTOS_USE_STATS_FORMATTING_FUNCTIONS and
  301. FREERTOS_USE_TRACE_FACILITY are enabled. vTaskGetRunTimeStats() will
  302. display the run time of each task as a % of the total run time of all
  303. CPUs (task run time / no of CPUs) / (total run time / 100 )
  304. choice FREERTOS_RUN_TIME_STATS_CLK
  305. prompt "Choose the clock source for run time stats"
  306. depends on FREERTOS_GENERATE_RUN_TIME_STATS
  307. default FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
  308. help
  309. Choose the clock source for FreeRTOS run time stats. Options are CPU0's
  310. CPU Clock or the ESP Timer. Both clock sources are 32 bits. The CPU
  311. Clock can run at a higher frequency hence provide a finer resolution
  312. but will overflow much quicker. Note that run time stats are only valid
  313. until the clock source overflows.
  314. config FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
  315. bool "Use ESP TIMER for run time stats"
  316. help
  317. ESP Timer will be used as the clock source for FreeRTOS run time stats.
  318. The ESP Timer runs at a frequency of 1MHz regardless of Dynamic
  319. Frequency Scaling. Therefore the ESP Timer will overflow in
  320. approximately 4290 seconds.
  321. config FREERTOS_RUN_TIME_STATS_USING_CPU_CLK
  322. bool "Use CPU Clock for run time stats"
  323. depends on FREERTOS_SYSTICK_USES_CCOUNT
  324. help
  325. CPU Clock will be used as the clock source for the generation of run
  326. time stats. The CPU Clock has a frequency dependent on
  327. ESP32_DEFAULT_CPU_FREQ_MHZ and Dynamic Frequency Scaling (DFS).
  328. Therefore the CPU Clock frequency can fluctuate between 80 to 240MHz.
  329. Run time stats generated using the CPU Clock represents the number of
  330. CPU cycles each task is allocated and DOES NOT reflect the amount of
  331. time each task runs for (as CPU clock frequency can change). If the CPU
  332. clock consistently runs at the maximum frequency of 240MHz, it will
  333. overflow in approximately 17 seconds.
  334. endchoice
  335. config FREERTOS_USE_TICKLESS_IDLE
  336. bool "Tickless idle support"
  337. depends on PM_ENABLE
  338. default n
  339. help
  340. If power management support is enabled, FreeRTOS will be able to put
  341. the system into light sleep mode when no tasks need to run for a number
  342. of ticks. This number can be set using FREERTOS_IDLE_TIME_BEFORE_SLEEP option.
  343. This feature is also known as "automatic light sleep".
  344. Note that timers created using esp_timer APIs may prevent the system from
  345. entering sleep mode, even when no tasks need to run.
  346. To skip unnecessary wake-up initialize a timer with the "skip_unhandled_events" option as true.
  347. If disabled, automatic light sleep support will be disabled.
  348. config FREERTOS_IDLE_TIME_BEFORE_SLEEP
  349. int "Minimum number of ticks to enter sleep mode for"
  350. depends on FREERTOS_USE_TICKLESS_IDLE
  351. default 3
  352. range 2 4294967295
  353. # Minimal value is 2 because of a check in FreeRTOS.h (search configEXPECTED_IDLE_TIME_BEFORE_SLEEP)
  354. help
  355. FreeRTOS will enter light sleep mode if no tasks need to run for this number
  356. of ticks.
  357. config FREERTOS_TASK_FUNCTION_WRAPPER
  358. bool "Enclose all task functions in a wrapper function"
  359. depends on COMPILER_OPTIMIZATION_DEFAULT
  360. default y
  361. help
  362. If enabled, all FreeRTOS task functions will be enclosed in a wrapper function.
  363. If a task function mistakenly returns (i.e. does not delete), the call flow will
  364. return to the wrapper function. The wrapper function will then log an error and
  365. abort the application. This option is also required for GDB backtraces and C++
  366. exceptions to work correctly inside top-level task functions.
  367. config FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER
  368. bool "Check that mutex semaphore is given by owner task"
  369. default y
  370. help
  371. If enabled, assert that when a mutex semaphore is given, the task giving the
  372. semaphore is the task which is currently holding the mutex.
  373. config FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE
  374. bool "Tests compliance with Vanilla FreeRTOS port*_CRITICAL calls"
  375. default n
  376. help
  377. If enabled, context of port*_CRITICAL calls (ISR or Non-ISR)
  378. would be checked to be in compliance with Vanilla FreeRTOS.
  379. e.g Calling port*_CRITICAL from ISR context would cause assert failure
  380. config FREERTOS_PLACE_FUNCTIONS_INTO_FLASH
  381. bool "Place FreeRTOS functions into Flash"
  382. default n
  383. help
  384. When enabled the selected Non-ISR FreeRTOS functions will be placed into Flash memory instead of IRAM.
  385. This saves up to 8KB of IRAM depending on which functions are used.
  386. config FREERTOS_DEBUG_OCDAWARE
  387. bool
  388. help
  389. Hidden option, gets selected by CONFIG_ESPxx_DEBUG_OCDAWARE
  390. config FREERTOS_FPU_IN_ISR
  391. bool "Allow use of float inside Level 1 ISR (EXPERIMENTAL)"
  392. depends on IDF_TARGET_ESP32
  393. default n
  394. help
  395. When enabled, the usage of float type is allowed inside Level 1
  396. ISRs.
  397. config FREERTOS_ENABLE_TASK_SNAPSHOT
  398. bool "Enable task snapshot functions"
  399. default y
  400. help
  401. When enabled, the functions related to snapshots, such as vTaskGetSnapshot or uxTaskGetSnapshotAll,
  402. are compiled and linked.
  403. config FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH
  404. bool "Place task snapshot functions into flash"
  405. default n
  406. depends on FREERTOS_ENABLE_TASK_SNAPSHOT && !ESP_PANIC_HANDLER_IRAM
  407. help
  408. When enabled, the functions related to snapshots, such as vTaskGetSnapshot or uxTaskGetSnapshotAll,
  409. will be placed in flash. Note that if enabled, these functions cannot be called when cache is disabled.
  410. endmenu