]> granicus.if.org Git - esp-idf/blob - components/esp32/Kconfig
Merge branch 'feature/tools_mass_mfg' into 'master'
[esp-idf] / components / esp32 / Kconfig
1 menu "ESP32-specific"
2
3 choice ESP32_DEFAULT_CPU_FREQ_MHZ
4     prompt "CPU frequency"
5     default ESP32_DEFAULT_CPU_FREQ_160
6     help
7         CPU frequency to be set on application startup.
8
9 config ESP32_DEFAULT_CPU_FREQ_80
10     bool "80 MHz"
11 config ESP32_DEFAULT_CPU_FREQ_160
12     bool "160 MHz"
13 config ESP32_DEFAULT_CPU_FREQ_240
14     bool "240 MHz"
15 endchoice
16
17 config ESP32_DEFAULT_CPU_FREQ_MHZ
18     int
19     default 80 if ESP32_DEFAULT_CPU_FREQ_80
20     default 160 if ESP32_DEFAULT_CPU_FREQ_160
21     default 240 if ESP32_DEFAULT_CPU_FREQ_240
22
23 config SPIRAM_SUPPORT
24     bool "Support for external, SPI-connected RAM"
25     default "n"
26     help
27         This enables support for an external SPI RAM chip, connected in parallel with the 
28         main SPI flash chip.
29
30 menu "SPI RAM config"
31     depends on SPIRAM_SUPPORT
32
33 config SPIRAM_BOOT_INIT
34     bool "Initialize SPI RAM when booting the ESP32"
35     default "y"
36     help
37         If this is enabled, the SPI RAM will be enabled during initial boot. Unless you
38         have specific requirements, you'll want to leave this enabled so memory allocated
39         during boot-up can also be placed in SPI RAM.
40
41 config SPIRAM_IGNORE_NOTFOUND
42     bool "Ignore PSRAM when not found"
43     default "n"
44     depends on SPIRAM_BOOT_INIT
45     help
46         Normally, if psram initialization is enabled during compile time but not found at runtime, it
47         is seen as an error making the ESP32 panic. If this is enabled, the ESP32 will keep on
48         running but will not add the (non-existing) RAM to any allocator.
49
50 choice SPIRAM_USE
51     prompt "SPI RAM access method"
52     default SPIRAM_USE_MALLOC
53     help
54         The SPI RAM can be accessed in multiple methods: by just having it available as an unmanaged
55         memory region in the ESP32 memory map, by integrating it in the ESP32s heap as 'special' memory
56         needing heap_caps_malloc to allocate, or by fully integrating it making malloc() also able to
57         return SPI RAM pointers.
58
59 config SPIRAM_USE_MEMMAP
60     bool "Integrate RAM into ESP32 memory map"
61 config SPIRAM_USE_CAPS_ALLOC
62     bool "Make RAM allocatable using heap_caps_malloc(..., MALLOC_CAP_SPIRAM)"
63 config SPIRAM_USE_MALLOC
64     bool "Make RAM allocatable using malloc() as well"
65     select SUPPORT_STATIC_ALLOCATION
66 endchoice
67
68 choice SPIRAM_TYPE
69     prompt "Type of SPI RAM chip in use"
70     default SPIRAM_TYPE_ESPPSRAM32
71
72 config SPIRAM_TYPE_ESPPSRAM32
73     bool "ESP-PSRAM32 or IS25WP032"
74 endchoice
75
76 config SPIRAM_SIZE
77     int
78     default 4194304 if SPIRAM_TYPE_ESPPSRAM32
79     default 0
80
81 choice SPIRAM_SPEED
82     prompt "Set RAM clock speed"
83     default SPIRAM_CACHE_SPEED_40M
84     help
85         Select the speed for the SPI RAM chip.
86         If SPI RAM is enabled, we only support three combinations of SPI speed mode we supported now:
87
88         1. Flash SPI running at 40Mhz and RAM SPI running at 40Mhz
89         2. Flash SPI running at 80Mhz and RAM SPI running at 40Mhz
90         3. Flash SPI running at 80Mhz and RAM SPI running at 80Mhz
91
92            Note: If the third mode(80Mhz+80Mhz) is enabled, the VSPI port will be occupied by the system.
93                  Application code should never touch VSPI hardware in this case. The option to select
94                  80MHz will only be visible if the flash SPI speed is also 80MHz. (ESPTOOLPY_FLASHFREQ_80M is true)
95
96 config SPIRAM_SPEED_40M
97     bool "40MHz clock speed"
98 config SPIRAM_SPEED_80M
99     depends on ESPTOOLPY_FLASHFREQ_80M
100     bool "80MHz clock speed"
101 endchoice
102
103 config SPIRAM_MEMTEST
104     bool "Run memory test on SPI RAM initialization"
105     default "y"
106     depends on SPIRAM_BOOT_INIT
107     help
108         Runs a rudimentary memory test on initialization. Aborts when memory test fails. Disable this for
109         slightly faster startop.
110
111 config SPIRAM_CACHE_WORKAROUND
112     bool "Enable workaround for bug in SPI RAM cache for Rev1 ESP32s"
113     depends on SPIRAM_USE_MEMMAP || SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC
114     default "y"
115     help
116         Revision 1 of the ESP32 has a bug that can cause a write to PSRAM not to take place in some situations
117         when the cache line needs to be fetched from external RAM and an interrupt occurs. This enables a
118         fix in the compiler that makes sure the specific code that is vulnerable to this will not be emitted.
119         
120         This will also not use any bits of newlib that are located in ROM, opting for a version that is compiled
121         with the workaround and located in flash instead.
122
123
124 config SPIRAM_MALLOC_ALWAYSINTERNAL
125     int "Maximum malloc() size, in bytes, to always put in internal memory"
126     depends on SPIRAM_USE_MALLOC
127     default 16384
128     range 0 131072
129     help
130         If malloc() is capable of also allocating SPI-connected ram, its allocation strategy will prefer to allocate chunks less
131         than this size in internal memory, while allocations larger than this will be done from external RAM.
132         If allocation from the preferred region fails, an attempt is made to allocate from the non-preferred
133         region instead, so malloc() will not suddenly fail when either internal or external memory is full.
134         
135 config WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
136     bool "Try to allocate memories of WiFi and LWIP in SPIRAM firstly. If failed, allocate internal memory"
137     depends on SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC
138     default "n"
139     help
140         Try to allocate memories of WiFi and LWIP in SPIRAM firstly. If failed, try to allocate internal memory then.
141
142 config SPIRAM_MALLOC_RESERVE_INTERNAL
143     int "Reserve this amount of bytes for data that specifically needs to be in DMA or internal memory"
144     depends on SPIRAM_USE_MALLOC
145     default 32768
146     range 0 131072
147     help
148         Because the external/internal RAM allocation strategy is not always perfect, it sometimes may happen
149         that the internal memory is entirely filled up. This causes allocations that are specifically done in
150         internal memory, for example the stack for new tasks or memory to service DMA or have memory that's 
151         also available when SPI cache is down, to fail. This option reserves a pool specifically for requests 
152         like that; the memory in this pool is not given out when a normal malloc() is called.
153         
154         Set this to 0 to disable this feature.
155         
156         Note that because FreeRTOS stacks are forced to internal memory, they will also use this memory pool;
157         be sure to keep this in mind when adjusting this value.
158
159 config SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
160     bool "Allow external memory as an argument to xTaskCreateStatic"
161     default n
162     depends on SPIRAM_USE_MALLOC
163     help
164         Because some bits of the ESP32 code environment cannot be recompiled with the cache workaround, normally
165         tasks cannot be safely run with their stack residing in external memory; for this reason xTaskCreate and
166         friends always allocate stack in internal memory and xTaskCreateStatic will check if the memory passed
167         to it is in internal memory. If you have a task that needs a large amount of stack and does not call on
168         ROM code in any way (no direct calls, but also no Bluetooth/WiFi), you can try to disable this and use
169         xTaskCreateStatic to create the tasks stack in external memory.
170
171 endmenu
172
173 config MEMMAP_TRACEMEM
174     bool
175     default "n"
176
177 config MEMMAP_TRACEMEM_TWOBANKS
178     bool
179     default "n"
180
181 config ESP32_TRAX
182     bool "Use TRAX tracing feature"
183     default "n"
184     select MEMMAP_TRACEMEM
185     help
186         The ESP32 contains a feature which allows you to trace the execution path the processor
187         has taken through the program. This is stored in a chunk of 32K (16K for single-processor)
188         of memory that can't be used for general purposes anymore. Disable this if you do not know
189         what this is.
190
191 config ESP32_TRAX_TWOBANKS
192     bool "Reserve memory for tracing both pro as well as app cpu execution"
193     default "n"
194     depends on ESP32_TRAX && !FREERTOS_UNICORE
195     select MEMMAP_TRACEMEM_TWOBANKS
196     help
197         The ESP32 contains a feature which allows you to trace the execution path the processor
198         has taken through the program. This is stored in a chunk of 32K (16K for single-processor)
199         of memory that can't be used for general purposes anymore. Disable this if you do not know
200         what this is.
201
202 # Memory to reverse for trace, used in linker script
203 config TRACEMEM_RESERVE_DRAM
204     hex
205     default 0x8000 if MEMMAP_TRACEMEM && MEMMAP_TRACEMEM_TWOBANKS
206     default 0x4000 if MEMMAP_TRACEMEM && !MEMMAP_TRACEMEM_TWOBANKS
207     default 0x0
208
209 choice ESP32_COREDUMP_TO_FLASH_OR_UART
210     prompt "Core dump destination"
211     default ESP32_ENABLE_COREDUMP_TO_NONE
212     help
213         Select place to store core dump: flash, uart or none (to disable core dumps generation).
214
215         If core dump is configured to be stored in flash and custom partition table is used add 
216         corresponding entry to your CSV. For examples, please see predefined partition table CSV descriptions 
217         in the components/partition_table directory.
218
219 config ESP32_ENABLE_COREDUMP_TO_FLASH
220     bool "Flash"
221     select ESP32_ENABLE_COREDUMP
222 config ESP32_ENABLE_COREDUMP_TO_UART
223     bool "UART"
224     select ESP32_ENABLE_COREDUMP
225 config ESP32_ENABLE_COREDUMP_TO_NONE
226     bool "None"
227 endchoice
228
229 config ESP32_ENABLE_COREDUMP
230     bool
231     default F
232     help
233         Enables/disable core dump module.
234
235 config ESP32_CORE_DUMP_UART_DELAY
236     int "Core dump print to UART delay"
237     depends on ESP32_ENABLE_COREDUMP_TO_UART
238     default 0
239     help
240         Config delay (in ms) before printing core dump to UART.
241         Delay can be interrupted by pressing Enter key.
242
243 config ESP32_CORE_DUMP_LOG_LEVEL
244     int "Core dump module logging level"
245     depends on ESP32_ENABLE_COREDUMP
246     default 1
247     help
248         Config core dump module logging level (0-5).
249
250 choice NUMBER_OF_UNIVERSAL_MAC_ADDRESS
251     bool "Number of universally administered (by IEEE) MAC address"
252     default FOUR_UNIVERSAL_MAC_ADDRESS
253     help
254         Configure the number of universally administered (by IEEE) MAC addresses.
255         During initialisation, MAC addresses for each network interface are generated or derived from a 
256         single base MAC address.
257         If the number of universal MAC addresses is four, all four interfaces (WiFi station, WiFi softap, 
258         Bluetooth and Ethernet) receive a universally administered MAC address. These are generated 
259         sequentially by adding 0, 1, 2 and 3 (respectively) to the final octet of the base MAC address.
260         If the number of universal MAC addresses is two, only two interfaces (WiFi station and Bluetooth) 
261         receive a universally administered MAC address. These are generated sequentially by adding 0 
262         and 1 (respectively) to the base MAC address. The remaining two interfaces (WiFi softap and Ethernet) 
263         receive local MAC addresses. These are derived from the universal WiFi station and Bluetooth MAC 
264         addresses, respectively.
265         When using the default (Espressif-assigned) base MAC address, either setting can be used. When using 
266         a custom universal MAC address range, the correct setting will depend on the allocation of MAC 
267         addresses in this range (either 2 or 4 per device.)
268
269 config TWO_UNIVERSAL_MAC_ADDRESS
270     bool "Two"
271 config FOUR_UNIVERSAL_MAC_ADDRESS
272     bool "Four"
273 endchoice
274
275 config NUMBER_OF_UNIVERSAL_MAC_ADDRESS
276     int 
277     default 2 if TWO_UNIVERSAL_MAC_ADDRESS
278     default 4 if FOUR_UNIVERSAL_MAC_ADDRESS
279
280 config SYSTEM_EVENT_QUEUE_SIZE
281     int "System event queue size"
282     default 32
283     help
284         Config system event queue size in different application.
285
286 config SYSTEM_EVENT_TASK_STACK_SIZE
287     int "Event loop task stack size"
288     default 2304
289     help
290         Config system event task stack size in different application.
291
292 config MAIN_TASK_STACK_SIZE
293     int "Main task stack size"
294     default 3584
295     help
296         Configure the "main task" stack size. This is the stack of the task
297         which calls app_main(). If app_main() returns then this task is deleted
298         and its stack memory is freed.
299
300 config IPC_TASK_STACK_SIZE
301     int "Inter-Processor Call (IPC) task stack size"
302     default 1024
303     range 512 65536 if !ESP32_APPTRACE_ENABLE
304     range 2048 65536 if ESP32_APPTRACE_ENABLE
305     help
306         Configure the IPC tasks stack size. One IPC task runs on each core
307         (in dual core mode), and allows for cross-core function calls.
308
309         See IPC documentation for more details.
310
311         The default stack size should be enough for most common use cases.
312         It can be shrunk if you are sure that you do not use any custom
313         IPC functionality.
314
315 config TIMER_TASK_STACK_SIZE
316     int "High-resolution timer task stack size"
317     default 3584
318     range 2048 65536
319     help
320         Configure the stack size of esp_timer/ets_timer task. This task is used
321         to dispatch callbacks of timers created using ets_timer and esp_timer
322         APIs. If you are seing stack overflow errors in timer task, increase
323         this value.
324         
325         Note that this is not the same as FreeRTOS timer task. To configure
326         FreeRTOS timer task size, see "FreeRTOS timer task stack size" option
327         in "FreeRTOS" menu. 
328
329 choice NEWLIB_STDOUT_LINE_ENDING
330     prompt "Line ending for UART output"
331     default NEWLIB_STDOUT_LINE_ENDING_CRLF
332     help
333         This option allows configuring the desired line endings sent to UART
334         when a newline ('\n', LF) appears on stdout.
335         Three options are possible:
336         
337         CRLF: whenever LF is encountered, prepend it with CR
338         
339         LF: no modification is applied, stdout is sent as is
340         
341         CR: each occurence of LF is replaced with CR
342         
343         This option doesn't affect behavior of the UART driver (drivers/uart.h).
344         
345 config NEWLIB_STDOUT_LINE_ENDING_CRLF
346     bool "CRLF"
347 config NEWLIB_STDOUT_LINE_ENDING_LF
348     bool "LF"
349 config NEWLIB_STDOUT_LINE_ENDING_CR
350     bool "CR"
351 endchoice
352
353 choice NEWLIB_STDIN_LINE_ENDING
354     prompt "Line ending for UART input"
355     default NEWLIB_STDIN_LINE_ENDING_CR
356     help
357         This option allows configuring which input sequence on UART produces
358         a newline ('\n', LF) on stdin.
359         Three options are possible:
360         
361         CRLF: CRLF is converted to LF
362         
363         LF: no modification is applied, input is sent to stdin as is
364         
365         CR: each occurence of CR is replaced with LF
366         
367         This option doesn't affect behavior of the UART driver (drivers/uart.h).
368         
369 config NEWLIB_STDIN_LINE_ENDING_CRLF
370     bool "CRLF"
371 config NEWLIB_STDIN_LINE_ENDING_LF
372     bool "LF"
373 config NEWLIB_STDIN_LINE_ENDING_CR
374     bool "CR"
375 endchoice
376
377 config NEWLIB_NANO_FORMAT
378     bool "Enable 'nano' formatting options for printf/scanf family"
379     default n
380     help
381         ESP32 ROM contains parts of newlib C library, including printf/scanf family
382         of functions. These functions have been compiled with so-called "nano"
383         formatting option. This option doesn't support 64-bit integer formats and C99
384         features, such as positional arguments.
385
386         For more details about "nano" formatting option, please see newlib readme file,
387         search for '--enable-newlib-nano-formatted-io':
388         https://sourceware.org/newlib/README
389
390         If this option is enabled, build system will use functions available in
391         ROM, reducing the application binary size. Functions available in ROM run
392         faster than functions which run from flash. Functions available in ROM can
393         also run when flash instruction cache is disabled.
394
395         If you need 64-bit integer formatting support or C99 features, keep this
396         option disabled.
397
398 choice CONSOLE_UART
399     prompt "UART for console output"
400     default CONSOLE_UART_DEFAULT
401     help
402         Select whether to use UART for console output (through stdout and stderr).
403         
404         - Default is to use UART0 on pins GPIO1(TX) and GPIO3(RX).
405         - If "Custom" is selected, UART0 or UART1 can be chosen,
406           and any pins can be selected.
407         - If "None" is selected, there will be no console output on any UART, except
408           for initial output from ROM bootloader. This output can be further suppressed by
409           bootstrapping GPIO13 pin to low logic level.
410
411 config CONSOLE_UART_DEFAULT
412     bool "Default: UART0, TX=GPIO1, RX=GPIO3"
413 config CONSOLE_UART_CUSTOM
414     bool "Custom"
415 config CONSOLE_UART_NONE
416     bool "None"
417 endchoice
418
419 choice CONSOLE_UART_NUM
420     prompt "UART peripheral to use for console output (0-1)"
421     depends on CONSOLE_UART_CUSTOM
422     default CONSOLE_UART_CUSTOM_NUM_0
423     help
424         Due of a ROM bug, UART2 is not supported for console output
425         via ets_printf.
426
427 config CONSOLE_UART_CUSTOM_NUM_0
428     bool "UART0"
429 config CONSOLE_UART_CUSTOM_NUM_1
430     bool "UART1"
431 endchoice
432
433 config CONSOLE_UART_NUM
434     int
435     default 0 if CONSOLE_UART_DEFAULT || CONSOLE_UART_NONE
436     default 0 if CONSOLE_UART_CUSTOM_NUM_0
437     default 1 if CONSOLE_UART_CUSTOM_NUM_1
438
439 config CONSOLE_UART_TX_GPIO
440     int "UART TX on GPIO#"
441     depends on CONSOLE_UART_CUSTOM
442     range 0 33
443     default 19
444
445 config CONSOLE_UART_RX_GPIO
446     int "UART RX on GPIO#"
447     depends on CONSOLE_UART_CUSTOM
448     range 0 39
449     default 21
450
451 config CONSOLE_UART_BAUDRATE
452     int "UART console baud rate"
453     depends on !CONSOLE_UART_NONE
454     default 115200
455     range 1200 4000000
456
457 config ULP_COPROC_ENABLED
458     bool "Enable Ultra Low Power (ULP) Coprocessor"
459     default "n"
460     help
461         Set to 'y' if you plan to load a firmware for the coprocessor.
462
463         If this option is enabled, further coprocessor configuration will appear in the Components menu.
464
465 config ULP_COPROC_RESERVE_MEM
466     int
467     prompt "RTC slow memory reserved for coprocessor" if ULP_COPROC_ENABLED
468     default 512 if ULP_COPROC_ENABLED
469     range 32 8192 if ULP_COPROC_ENABLED
470     default 0 if !ULP_COPROC_ENABLED
471     range 0 0 if !ULP_COPROC_ENABLED
472     help
473         Bytes of memory to reserve for ULP coprocessor firmware & data.
474
475         Data is reserved at the beginning of RTC slow memory.
476
477 choice ESP32_PANIC
478     prompt "Panic handler behaviour"
479     default ESP32_PANIC_PRINT_REBOOT
480     help
481         If FreeRTOS detects unexpected behaviour or an unhandled exception, the panic handler is
482         invoked. Configure the panic handlers action here.
483
484 config ESP32_PANIC_PRINT_HALT
485     bool "Print registers and halt"
486     help
487         Outputs the relevant registers over the serial port and halt the
488         processor. Needs a manual reset to restart.
489
490 config ESP32_PANIC_PRINT_REBOOT
491     bool "Print registers and reboot"
492     help
493         Outputs the relevant registers over the serial port and immediately
494         reset the processor.
495
496 config ESP32_PANIC_SILENT_REBOOT
497     bool "Silent reboot"
498     help
499         Just resets the processor without outputting anything
500
501 config ESP32_PANIC_GDBSTUB
502     bool "Invoke GDBStub"
503     help
504         Invoke gdbstub on the serial port, allowing for gdb to attach to it to do a postmortem
505         of the crash.
506 endchoice
507
508 config ESP32_DEBUG_OCDAWARE
509     bool "Make exception and panic handlers JTAG/OCD aware"
510     default y
511     help
512         The FreeRTOS panic and unhandled exception handers can detect a JTAG OCD debugger and
513         instead of panicking, have the debugger stop on the offending instruction.
514
515 config ESP32_DEBUG_STUBS_ENABLE
516     bool "OpenOCD debug stubs"
517     default OPTIMIZATION_LEVEL_DEBUG    
518     depends on !ESP32_TRAX
519     help
520         Debug stubs are used by OpenOCD to execute pre-compiled onboard code which does some useful debugging, 
521         e.g. GCOV data dump.
522
523 config INT_WDT
524     bool "Interrupt watchdog"
525     default y
526     help
527         This watchdog timer can detect if the FreeRTOS tick interrupt has not been called for a certain time,
528         either because a task turned off interrupts and did not turn them on for a long time, or because an
529         interrupt handler did not return. It will try to invoke the panic handler first and failing that
530         reset the SoC.
531
532 config INT_WDT_TIMEOUT_MS
533     int "Interrupt watchdog timeout (ms)"
534     depends on INT_WDT
535     default 300 if !SPIRAM_SUPPORT
536     default 800 if SPIRAM_SUPPORT
537     range 10 10000
538     help
539         The timeout of the watchdog, in miliseconds. Make this higher than the FreeRTOS tick rate.
540
541 config INT_WDT_CHECK_CPU1
542     bool "Also watch CPU1 tick interrupt"
543     depends on INT_WDT && !FREERTOS_UNICORE
544     default y
545     help
546         Also detect if interrupts on CPU 1 are disabled for too long.
547
548 config TASK_WDT
549     bool "Initialize Task Watchdog Timer on startup"
550     default y
551     help
552         The Task Watchdog Timer can be used to make sure individual tasks are still
553         running. Enabling this option will cause the Task Watchdog Timer to be
554         initialized automatically at startup. The Task Watchdog timer can be 
555         initialized after startup as well (see Task Watchdog Timer API Reference)
556
557 config TASK_WDT_PANIC
558     bool "Invoke panic handler on Task Watchdog timeout"
559     depends on TASK_WDT
560     default n
561     help
562         If this option is enabled, the Task Watchdog Timer will be configured to
563         trigger the panic handler when it times out. This can also be configured
564         at run time (see Task Watchdog Timer API Reference)
565
566 config TASK_WDT_TIMEOUT_S
567     int "Task Watchdog timeout period (seconds)"
568     depends on TASK_WDT
569     range 1 60
570     default 5
571     help
572         Timeout period configuration for the Task Watchdog Timer in seconds.
573         This is also configurable at run time (see Task Watchdog Timer API Reference)
574
575 config TASK_WDT_CHECK_IDLE_TASK_CPU0
576     bool "Watch CPU0 Idle Task"
577     depends on TASK_WDT
578     default y
579     help
580         If this option is enabled, the Task Watchdog Timer will watch the CPU0
581         Idle Task. Having the Task Watchdog watch the Idle Task allows for detection
582         of CPU starvation as the Idle Task not being called is usually a symptom of
583         CPU starvation. Starvation of the Idle Task is detrimental as FreeRTOS household
584         tasks depend on the Idle Task getting some runtime every now and then.
585
586 config TASK_WDT_CHECK_IDLE_TASK_CPU1
587     bool "Watch CPU1 Idle Task"
588     depends on TASK_WDT && !FREERTOS_UNICORE
589     default y
590     help
591         If this option is enabled, the Task Wtachdog Timer will wach the CPU1
592         Idle Task.
593
594 #The brownout detector code is disabled (by making it depend on a nonexisting symbol) because the current revision of ESP32
595 #silicon has a bug in the brown-out detector, rendering it unusable for resetting the CPU.
596 config BROWNOUT_DET
597     bool "Hardware brownout detect & reset"
598     default y
599     help
600         The ESP32 has a built-in brownout detector which can detect if the voltage is lower than
601         a specific value. If this happens, it will reset the chip in order to prevent unintended
602         behaviour.
603
604 choice BROWNOUT_DET_LVL_SEL
605     prompt "Brownout voltage level"
606     depends on BROWNOUT_DET
607     default BROWNOUT_DET_LVL_SEL_25
608     help
609         The brownout detector will reset the chip when the supply voltage is approximately
610         below this level. Note that there may be some variation of brownout voltage level
611         between each ESP32 chip.
612
613 #The voltage levels here are estimates, more work needs to be done to figure out the exact voltages
614 #of the brownout threshold levels.
615 config BROWNOUT_DET_LVL_SEL_0
616     bool "2.43V +/- 0.05"
617 config BROWNOUT_DET_LVL_SEL_1
618     bool "2.48V +/- 0.05"
619 config BROWNOUT_DET_LVL_SEL_2
620     bool "2.58V +/- 0.05"
621 config BROWNOUT_DET_LVL_SEL_3
622     bool "2.62V +/- 0.05"
623 config BROWNOUT_DET_LVL_SEL_4
624     bool "2.67V +/- 0.05"
625 config BROWNOUT_DET_LVL_SEL_5
626     bool "2.70V +/- 0.05"
627 config BROWNOUT_DET_LVL_SEL_6
628     bool "2.77V +/- 0.05"
629 config BROWNOUT_DET_LVL_SEL_7
630     bool "2.80V +/- 0.05"
631 endchoice
632
633 config BROWNOUT_DET_LVL
634     int
635     default 0 if BROWNOUT_DET_LVL_SEL_0
636     default 1 if BROWNOUT_DET_LVL_SEL_1
637     default 2 if BROWNOUT_DET_LVL_SEL_2
638     default 3 if BROWNOUT_DET_LVL_SEL_3
639     default 4 if BROWNOUT_DET_LVL_SEL_4
640     default 5 if BROWNOUT_DET_LVL_SEL_5
641     default 6 if BROWNOUT_DET_LVL_SEL_6
642     default 7 if BROWNOUT_DET_LVL_SEL_7
643
644
645 # Note about the use of "FRC1" name: currently FRC1 timer is not used for
646 # high resolution timekeeping anymore. Instead the esp_timer API, implemented
647 # using FRC2 timer, is used.
648 # FRC1 name in the option name is kept for compatibility.
649 choice ESP32_TIME_SYSCALL
650     prompt "Timers used for gettimeofday function"
651     default ESP32_TIME_SYSCALL_USE_RTC_FRC1
652     help
653         This setting defines which hardware timers are used to
654         implement 'gettimeofday' and 'time' functions in C library.
655
656         - If both high-resolution and RTC timers are used, timekeeping will
657           continue in deep sleep. Time will be reported at 1 microsecond
658           resolution. This is the default, and the recommended option.
659         - If only high-resolution timer is used, gettimeofday will
660           provide time at microsecond resolution. 
661           Time will not be preserved when going into deep sleep mode.
662         - If only RTC timer is used, timekeeping will continue in
663           deep sleep, but time will be measured at 6.(6) microsecond
664           resolution. Also the gettimeofday function itself may take
665           longer to run.
666         - If no timers are used, gettimeofday and time functions
667           return -1 and set errno to ENOSYS.
668         - When RTC is used for timekeeping, two RTC_STORE registers are
669           used to keep time in deep sleep mode.
670
671 config ESP32_TIME_SYSCALL_USE_RTC_FRC1
672     bool "RTC and high-resolution timer"
673 config ESP32_TIME_SYSCALL_USE_RTC
674     bool "RTC"
675 config ESP32_TIME_SYSCALL_USE_FRC1
676     bool "High-resolution timer"
677 config ESP32_TIME_SYSCALL_USE_NONE
678     bool "None"
679 endchoice
680
681 choice ESP32_RTC_CLOCK_SOURCE
682     prompt "RTC clock source"
683     default ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC
684     help
685         Choose which clock is used as RTC clock source.
686
687 config ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC
688     bool "Internal 150kHz RC oscillator"
689 config ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
690     bool "External 32kHz crystal"
691 endchoice
692
693 config ESP32_RTC_CLK_CAL_CYCLES
694     int "Number of cycles for RTC_SLOW_CLK calibration"
695     default 3000 if ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
696     default 1024 if ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC
697     range 0 27000 if ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
698     range 0 32766 if ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC
699     help
700         When the startup code initializes RTC_SLOW_CLK, it can perform
701         calibration by comparing the RTC_SLOW_CLK frequency with main XTAL
702         frequency. This option sets the number of RTC_SLOW_CLK cycles measured
703         by the calibration routine. Higher numbers increase calibration
704         precision, which may be important for applications which spend a lot of
705         time in deep sleep. Lower numbers reduce startup time.
706         
707         When this option is set to 0, clock calibration will not be performed at
708         startup, and approximate clock frequencies will be assumed:
709
710         - 150000 Hz if internal RC oscillator is used as clock source. For this use value 1024.
711         - 32768 Hz if the 32k crystal oscillator is used. For this use value 3000 or more.
712           In case more value will help improve the definition of the launch of the crystal.
713           If the crystal could not start, it will be switched to internal RC.
714
715 config ESP32_RTC_XTAL_BOOTSTRAP_CYCLES
716     int "Bootstrap cycles for external 32kHz crystal"
717     depends on ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
718     default 5
719     range 0 32768
720     help
721         To reduce the startup time of an external RTC crystal, 
722         we bootstrap it with a 32kHz square wave for a fixed number of cycles. 
723         Setting 0 will disable bootstrapping (if disabled, the crystal may take 
724         longer to start up or fail to oscillate under some conditions).
725         
726         If this value is too high, a faulty crystal may initially start and then fail. 
727         If this value is too low, an otherwise good crystal may not start.
728         
729         To accurately determine if the crystal has started, 
730         set a larger "Number of cycles for RTC_SLOW_CLK calibration" (about 3000).
731
732 config ESP32_DEEP_SLEEP_WAKEUP_DELAY
733     int "Extra delay in deep sleep wake stub (in us)"
734     default 2000
735     range 0 5000
736     help
737         When ESP32 exits deep sleep, the CPU and the flash chip are powered on
738         at the same time. CPU will run deep sleep stub first, and then
739         proceed to load code from flash. Some flash chips need sufficient
740         time to pass between power on and first read operation. By default,
741         without any extra delay, this time is approximately 900us, although
742         some flash chip types need more than that.
743         
744         By default extra delay is set to 2000us. When optimizing startup time
745         for applications which require it, this value may be reduced. 
746
747         If you are seeing "flash read err, 1000" message printed to the
748         console after deep sleep reset, try increasing this value.
749
750 choice ESP32_XTAL_FREQ_SEL
751     prompt "Main XTAL frequency"
752     default ESP32_XTAL_FREQ_40
753     help
754         ESP32 currently supports the following XTAL frequencies:
755
756         - 26 MHz
757         - 40 MHz
758
759         Startup code can automatically estimate XTAL frequency. This feature
760         uses the internal 8MHz oscillator as a reference. Because the internal
761         oscillator frequency is temperature dependent, it is not recommended
762         to use automatic XTAL frequency detection in applications which need
763         to work at high ambient temperatures and use high-temperature
764         qualified chips and modules.
765 config ESP32_XTAL_FREQ_40
766     bool "40 MHz"
767 config ESP32_XTAL_FREQ_26
768     bool "26 MHz"
769 config ESP32_XTAL_FREQ_AUTO
770     bool "Autodetect"
771 endchoice
772
773 # Keep these values in sync with rtc_xtal_freq_t enum in soc/rtc.h
774 config ESP32_XTAL_FREQ
775     int
776     default 0 if ESP32_XTAL_FREQ_AUTO
777     default 40 if ESP32_XTAL_FREQ_40
778     default 26 if ESP32_XTAL_FREQ_26
779
780 config DISABLE_BASIC_ROM_CONSOLE
781     bool "Permanently disable BASIC ROM Console"
782     default n
783     help
784         If set, the first time the app boots it will disable the BASIC ROM Console
785         permanently (by burning an efuse).
786
787         Otherwise, the BASIC ROM Console starts on reset if no valid bootloader is
788         read from the flash.
789
790         (Enabling secure boot also disables the BASIC ROM Console by default.)
791
792 config NO_BLOBS
793     bool "No Binary Blobs"
794     depends on !BT_ENABLED
795     default n
796     help
797        If enabled, this disables the linking of binary libraries in the application build. Note
798        that after enabling this Wi-Fi/Bluetooth will not work.
799
800 config ESP_TIMER_PROFILING
801         bool "Enable esp_timer profiling features"
802         default n
803         help
804                 If enabled, esp_timer_dump will dump information such as number of times
805                 the timer was started, number of times the timer has triggered, and the
806                 total time it took for the callback to run.
807                 This option has some effect on timer performance and the amount of memory
808                 used for timer storage, and should only be used for debugging/testing
809                 purposes.
810
811 config COMPATIBLE_PRE_V2_1_BOOTLOADERS
812     bool "App compatible with bootloaders before IDF v2.1"
813     default n
814     help
815         Bootloaders before IDF v2.1 did less initialisation of the
816         system clock. This setting needs to be enabled to build an app
817         which can be booted by these older bootloaders.
818
819         If this setting is enabled, the app can be booted by any bootloader
820         from IDF v1.0 up to the current version.
821
822         If this setting is disabled, the app can only be booted by bootloaders
823         from IDF v2.1 or newer.
824
825         Enabling this setting adds approximately 1KB to the app's IRAM usage.
826
827 config ESP_ERR_TO_NAME_LOOKUP
828     bool "Enable lookup of error code strings"
829     default "y"
830     help
831         Functions esp_err_to_name() and esp_err_to_name_r() return string
832         representations of error codes from a pre-generated lookup table.
833         This option can be used to turn off the use of the look-up table in
834         order to save memory but this comes at the price of sacrificing
835         distinguishable (meaningful) output string representations.
836
837 endmenu  # ESP32-Specific
838
839 menu Wi-Fi
840
841 config SW_COEXIST_ENABLE
842     bool "Software controls WiFi/Bluetooth coexistence"
843     depends on BT_ENABLED
844     default y
845     help
846         If enabled, WiFi & Bluetooth coexistence is controlled by software rather than hardware.
847         Recommended for heavy traffic scenarios. Both coexistence configuration options are
848         automatically managed, no user intervention is required.
849
850 choice SW_COEXIST_PREFERENCE
851     prompt "WiFi/Bluetooth coexistence performance preference"
852     depends on SW_COEXIST_ENABLE
853     default SW_COEXIST_PREFERENCE_BALANCE
854     help
855         Choose Bluetooth/WiFi/Balance for different preference.
856         If choose WiFi, it will make WiFi performance better. Such, keep WiFi Audio more fluent.
857         If choose Bluetooth, it will make Bluetooth performance better. Such, keep Bluetooth(A2DP) Audio more fluent.
858         If choose Balance, the performance of WiFi and bluetooth will be balance. It's default. Normally, just choose balance, the A2DP audio can play fluently, too.
859         Except config preference in menuconfig, you can also call esp_coex_preference_set() dynamically.
860
861 config SW_COEXIST_PREFERENCE_WIFI
862     bool "WiFi"
863
864 config SW_COEXIST_PREFERENCE_BT
865     bool "Bluetooth(include BR/EDR and BLE)"
866
867 config SW_COEXIST_PREFERENCE_BALANCE
868     bool "Balance"
869
870 endchoice
871
872 config SW_COEXIST_PREFERENCE_VALUE
873     int
874     depends on SW_COEXIST_ENABLE
875     default 0 if SW_COEXIST_PREFERENCE_WIFI
876     default 1 if SW_COEXIST_PREFERENCE_BT
877     default 2 if SW_COEXIST_PREFERENCE_BALANCE
878
879 config ESP32_WIFI_STATIC_RX_BUFFER_NUM
880     int "Max number of WiFi static RX buffers"
881     range 2 25
882     default 10
883     help
884         Set the number of WiFi static RX buffers. Each buffer takes approximately 1.6KB of RAM.
885         The static rx buffers are allocated when esp_wifi_init is called, they are not freed
886         until esp_wifi_deinit is called.
887
888         WiFi hardware use these buffers to receive all 802.11 frames.
889         A higher number may allow higher throughput but increases memory use.
890
891 config ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM
892     int "Max number of WiFi dynamic RX buffers"
893     range 0 128
894     default 32
895     help
896         Set the number of WiFi dynamic RX buffers, 0 means unlimited RX buffers will be allocated
897         (provided sufficient free RAM). The size of each dynamic RX buffer depends on the size of
898         the received data frame.
899
900         For each received data frame, the WiFi driver makes a copy to an RX buffer and then delivers
901         it to the high layer TCP/IP stack. The dynamic RX buffer is freed after the higher layer has
902         successfully received the data frame.
903
904         For some applications, WiFi data frames may be received faster than the application can
905         process them. In these cases we may run out of memory if RX buffer number is unlimited (0).
906
907         If a dynamic RX buffer limit is set, it should be at least the number of static RX buffers.
908
909 choice ESP32_WIFI_TX_BUFFER
910     prompt "Type of WiFi TX buffers"
911     default ESP32_WIFI_DYNAMIC_TX_BUFFER
912     help
913         Select type of WiFi TX buffers:
914
915         If "Static" is selected, WiFi TX buffers are allocated when WiFi is initialized and released
916         when WiFi is de-initialized. The size of each static TX buffer is fixed to about 1.6KB.
917
918         If "Dynamic" is selected, each WiFi TX buffer is allocated as needed when a data frame is
919         delivered to the Wifi driver from the TCP/IP stack. The buffer is freed after the data frame
920         has been sent by the WiFi driver. The size of each dynamic TX buffer depends on the length
921         of each data frame sent by the TCP/IP layer.
922
923         If PSRAM is enabled, "Static" should be selected to guarantee enough WiFi TX buffers.
924         If PSRAM is disabled, "Dynamic" should be selected to improve the utilization of RAM.
925
926 config ESP32_WIFI_STATIC_TX_BUFFER
927     bool "Static"
928 config ESP32_WIFI_DYNAMIC_TX_BUFFER
929     bool "Dynamic"
930     depends on !SPIRAM_USE_MALLOC
931 endchoice
932
933 config ESP32_WIFI_TX_BUFFER_TYPE
934     int
935     default 0 if ESP32_WIFI_STATIC_TX_BUFFER
936     default 1 if ESP32_WIFI_DYNAMIC_TX_BUFFER
937
938 config ESP32_WIFI_STATIC_TX_BUFFER_NUM
939     int "Max number of WiFi static TX buffers"
940     depends on ESP32_WIFI_STATIC_TX_BUFFER
941     range 6 64
942     default 16
943     help
944         Set the number of WiFi static TX buffers. Each buffer takes approximately 1.6KB of RAM.
945         The static RX buffers are allocated when esp_wifi_init() is called, they are not released
946         until esp_wifi_deinit() is called.
947
948         For each transmitted data frame from the higher layer TCP/IP stack, the WiFi driver makes a
949         copy of it in a TX buffer.  For some applications especially UDP applications, the upper
950         layer can deliver frames faster than WiFi layer can transmit. In these cases, we may run out
951         of TX buffers.
952
953 config ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM
954     int "Max number of WiFi dynamic TX buffers"
955     depends on ESP32_WIFI_DYNAMIC_TX_BUFFER
956     range 16 128
957     default 32
958     help
959         Set the number of WiFi dynamic TX buffers. The size of each dynamic TX buffer is not fixed,
960         it depends on the size of each transmitted data frame.
961
962         For each transmitted frame from the higher layer TCP/IP stack, the WiFi driver makes a copy
963         of it in a TX buffer. For some applications, especially UDP applications, the upper layer
964         can deliver frames faster than WiFi layer can transmit. In these cases, we may run out of TX
965         buffers.
966
967 config ESP32_WIFI_CSI_ENABLED
968     bool "WiFi CSI(Channel State Information)"
969     default n
970     help
971         Select this option to enable CSI(Channel State Information) feature. CSI takes about 
972         CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM KB of RAM. If CSI is not used, it is better to disable 
973         this feature in order to save memory.
974
975 config ESP32_WIFI_AMPDU_TX_ENABLED
976     bool "WiFi AMPDU TX"
977     default y
978     help
979         Select this option to enable AMPDU TX feature
980
981
982 config ESP32_WIFI_TX_BA_WIN
983     int "WiFi AMPDU TX BA window size"
984     depends on ESP32_WIFI_AMPDU_TX_ENABLED
985     range 2 32
986     default 6
987     help
988         Set the size of WiFi Block Ack TX window. Generally a bigger value means higher throughput but
989         more memory. Most of time we should NOT change the default value unless special reason, e.g. 
990         test the maximum UDP TX throughput with iperf etc. For iperf test in shieldbox, the recommended
991         value is 9~12.
992
993 config ESP32_WIFI_AMPDU_RX_ENABLED
994     bool "WiFi AMPDU RX"
995     default y
996     help
997         Select this option to enable AMPDU RX feature
998
999 config ESP32_WIFI_RX_BA_WIN
1000     int "WiFi AMPDU RX BA window size"
1001     depends on ESP32_WIFI_AMPDU_RX_ENABLED
1002     range 2 32
1003     default 6
1004     help
1005         Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput but 
1006         more memory. Most of time we should NOT change the default value unless special reason, e.g.  
1007         test the maximum UDP RX throughput with iperf etc. For iperf test in shieldbox, the recommended
1008         value is 9~12.
1009
1010 config ESP32_WIFI_NVS_ENABLED
1011     bool "WiFi NVS flash"
1012     default y
1013     help
1014         Select this option to enable WiFi NVS flash
1015
1016 choice ESP32_WIFI_TASK_CORE_ID
1017     depends on !FREERTOS_UNICORE
1018     prompt "WiFi Task Core ID"
1019     default ESP32_WIFI_TASK_PINNED_TO_CORE_0
1020     help
1021         Pinned WiFi task to core 0 or core 1.
1022
1023 config ESP32_WIFI_TASK_PINNED_TO_CORE_0
1024     bool "Core 0"
1025 config ESP32_WIFI_TASK_PINNED_TO_CORE_1
1026     bool "Core 1"
1027 endchoice
1028
1029 endmenu  # Wi-Fi
1030
1031 menu PHY
1032
1033 config ESP32_PHY_CALIBRATION_AND_DATA_STORAGE
1034     bool "Store phy calibration data in NVS"
1035     default y
1036     help
1037         If this option is enabled, NVS will be initialized and calibration data will be loaded from there.
1038         PHY calibration will be skipped on deep sleep wakeup. If calibration data is not found, full calibration
1039         will be performed and stored in NVS. Normally, only partial calibration will be performed. 
1040         If this option is disabled, full calibration will be performed.
1041
1042         If it's easy that your board calibrate bad data, choose 'n'.
1043         Two cases for example, you should choose 'n':
1044         1.If your board is easy to be booted up with antenna disconnected.
1045         2.Because of your board design, each time when you do calibration, the result are too unstable.
1046         If unsure, choose 'y'.
1047
1048 config ESP32_PHY_INIT_DATA_IN_PARTITION
1049     bool "Use a partition to store PHY init data"
1050     default n
1051     help
1052         If enabled, PHY init data will be loaded from a partition.
1053         When using a custom partition table, make sure that PHY data
1054         partition is included (type: 'data', subtype: 'phy').
1055         With default partition tables, this is done automatically.
1056         If PHY init data is stored in a partition, it has to be flashed there,
1057         otherwise runtime error will occur.
1058
1059         If this option is not enabled, PHY init data will be embedded
1060         into the application binary.
1061
1062         If unsure, choose 'n'.
1063         
1064 config ESP32_PHY_MAX_WIFI_TX_POWER
1065     int "Max WiFi TX power (dBm)"
1066     range 0 20
1067     default 20
1068     help
1069         Set maximum transmit power for WiFi radio. Actual transmit power for high
1070         data rates may be lower than this setting.
1071
1072 config ESP32_PHY_MAX_TX_POWER
1073         int
1074         default ESP32_PHY_MAX_WIFI_TX_POWER
1075
1076 endmenu  # PHY
1077
1078
1079 menu "Power Management"
1080
1081 config PM_ENABLE
1082         bool "Support for power management"
1083         default n
1084         help
1085                 If enabled, application is compiled with support for power management.
1086                 This option has run-time overhead (increased interrupt latency,
1087                 longer time to enter idle state), and it also reduces accuracy of
1088                 RTOS ticks and timers used for timekeeping.
1089                 Enable this option if application uses power management APIs. 
1090
1091 config PM_DFS_INIT_AUTO
1092         bool "Enable dynamic frequency scaling (DFS) at startup"
1093         depends on PM_ENABLE
1094         default n
1095         help
1096                 If enabled, startup code configures dynamic frequency scaling.
1097                 Max CPU frequency is set to CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ setting,
1098                 min frequency is set to XTAL frequency.
1099                 If disabled, DFS will not be active until the application
1100                 configures it using esp_pm_configure function.
1101
1102 config PM_USE_RTC_TIMER_REF
1103         bool "Use RTC timer to prevent time drift (EXPERIMENTAL)"
1104         depends on PM_ENABLE && (ESP32_TIME_SYSCALL_USE_RTC || ESP32_TIME_SYSCALL_USE_RTC_FRC1)
1105         default n
1106         help
1107                 When APB clock frequency changes, high-resolution timer (esp_timer)
1108                 scale and base value need to be adjusted. Each adjustment may cause
1109                 small error, and over time such small errors may cause time drift.
1110                 If this option is enabled, RTC timer will be used as a reference to
1111                 compensate for the drift.
1112                 It is recommended that this option is only used if 32k XTAL is selected
1113                 as RTC clock source.
1114
1115 config PM_PROFILING
1116         bool "Enable profiling counters for PM locks"
1117         depends on PM_ENABLE
1118         default n
1119         help
1120                 If enabled, esp_pm_* functions will keep track of the amount of time
1121                 each of the power management locks has been held, and esp_pm_dump_locks
1122                 function will print this information.
1123                 This feature can be used to analyze which locks are preventing the chip
1124                 from going into a lower power state, and see what time the chip spends
1125                 in each power saving mode. This feature does incur some run-time
1126                 overhead, so should typically be disabled in production builds. 
1127
1128 config PM_TRACE
1129         bool "Enable debug tracing of PM using GPIOs"
1130         depends on PM_ENABLE
1131         default n
1132         help
1133                 If enabled, some GPIOs will be used to signal events such as RTOS ticks,
1134                 frequency switching, entry/exit from idle state. Refer to pm_trace.c
1135                 file for the list of GPIOs.
1136                 This feature is intended to be used when analyzing/debugging behavior
1137                 of power management implementation, and should be kept disabled in
1138                 applications.
1139         
1140
1141 endmenu # "Power Management"