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