Kconfig 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. menu "ESP System Settings"
  2. choice ESP_SYSTEM_PANIC
  3. prompt "Panic handler behaviour"
  4. default ESP_SYSTEM_PANIC_PRINT_REBOOT
  5. help
  6. If FreeRTOS detects unexpected behaviour or an unhandled exception, the panic handler is
  7. invoked. Configure the panic handler's action here.
  8. config ESP_SYSTEM_PANIC_PRINT_HALT
  9. bool "Print registers and halt"
  10. help
  11. Outputs the relevant registers over the serial port and halt the
  12. processor. Needs a manual reset to restart.
  13. config ESP_SYSTEM_PANIC_PRINT_REBOOT
  14. bool "Print registers and reboot"
  15. help
  16. Outputs the relevant registers over the serial port and immediately
  17. reset the processor.
  18. config ESP_SYSTEM_PANIC_SILENT_REBOOT
  19. bool "Silent reboot"
  20. help
  21. Just resets the processor without outputting anything
  22. config ESP_SYSTEM_PANIC_GDBSTUB
  23. bool "GDBStub on panic"
  24. select ESP_GDBSTUB_ENABLED
  25. help
  26. Invoke gdbstub on the serial port, allowing for gdb to attach to it to do a postmortem
  27. of the crash.
  28. config ESP_SYSTEM_GDBSTUB_RUNTIME
  29. bool "GDBStub at runtime"
  30. select FREERTOS_UNICORE
  31. select ESP_GDBSTUB_ENABLED
  32. help
  33. Invoke gdbstub on the serial port, allowing for gdb to attach to it and to do a debug on runtime.
  34. This feature will switch system to single core mode.
  35. endchoice
  36. config ESP_SYSTEM_SINGLE_CORE_MODE
  37. bool
  38. default n
  39. help
  40. Only initialize and use the main core.
  41. config ESP_SYSTEM_RTC_EXT_XTAL
  42. # This is a High Layer Kconfig option, invisible, can be selected by other Kconfig option
  43. # e.g. It will be selected on when ESP32_RTC_CLK_SRC_EXT_CRYS is on
  44. bool
  45. default n
  46. config ESP_SYSTEM_RTC_EXT_OSC
  47. # This is a High Layer Kconfig option, invisible, can be selected by other Kconfig option
  48. # e.g. It will be selected on when ESPX_RTC_CLK_SRC_EXT_OSC is on
  49. bool
  50. default n
  51. config ESP_SYSTEM_RTC_EXT_XTAL_BOOTSTRAP_CYCLES
  52. int "Bootstrap cycles for external 32kHz crystal"
  53. depends on ESP_SYSTEM_RTC_EXT_XTAL
  54. default 5 if IDF_TARGET_ESP32
  55. default 0
  56. range 0 32768
  57. help
  58. To reduce the startup time of an external RTC crystal,
  59. we bootstrap it with a 32kHz square wave for a fixed number of cycles.
  60. Setting 0 will disable bootstrapping (if disabled, the crystal may take
  61. longer to start up or fail to oscillate under some conditions).
  62. If this value is too high, a faulty crystal may initially start and then fail.
  63. If this value is too low, an otherwise good crystal may not start.
  64. To accurately determine if the crystal has started,
  65. set a larger "Number of cycles for RTC_SLOW_CLK calibration" (about 3000).
  66. config ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK
  67. bool
  68. default y if IDF_TARGET_ESP32 && FREERTOS_UNICORE
  69. default y if IDF_TARGET_ESP32S2
  70. default y if IDF_TARGET_ESP32C3
  71. default y if IDF_TARGET_ESP32S3
  72. default y if IDF_TARGET_ESP32H2
  73. config ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP
  74. bool "Enable RTC fast memory for dynamic allocations"
  75. default y
  76. depends on ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK
  77. help
  78. This config option allows to add RTC fast memory region to system heap with capability
  79. similar to that of DRAM region but without DMA. This memory will be consumed first per
  80. heap initialization order by early startup services and scheduler related code. Speed
  81. wise RTC fast memory operates on APB clock and hence does not have much performance impact.
  82. config ESP_SYSTEM_USE_EH_FRAME
  83. bool "Generate and use eh_frame for backtracing"
  84. default n
  85. depends on IDF_TARGET_ARCH_RISCV
  86. help
  87. Generate DWARF information for each function of the project. These information will parsed and used to
  88. perform backtracing when panics occur. Activating this option will activate asynchronous frame unwinding
  89. and generation of both .eh_frame and .eh_frame_hdr sections, resulting in a bigger binary size (20% to
  90. 100% larger). The main purpose of this option is to be able to have a backtrace parsed and printed by
  91. the program itself, regardless of the serial monitor used.
  92. This option shall NOT be used for production.
  93. menu "Memory protection"
  94. config ESP_SYSTEM_MEMPROT_DEPCHECK
  95. bool
  96. default y if IDF_TARGET_ESP32S2
  97. default y if IDF_TARGET_ESP32C3
  98. default y if IDF_TARGET_ESP32H2
  99. config ESP_SYSTEM_MEMPROT_FEATURE
  100. bool "Enable memory protection"
  101. depends on ESP_SYSTEM_MEMPROT_DEPCHECK
  102. default "y"
  103. help
  104. If enabled, the permission control module watches all the memory access and fires the panic handler
  105. if a permission violation is detected. This feature automatically splits
  106. the SRAM memory into data and instruction segments and sets Read/Execute permissions
  107. for the instruction part (below given splitting address) and Read/Write permissions
  108. for the data part (above the splitting address). The memory protection is effective
  109. on all access through the IRAM0 and DRAM0 buses.
  110. config ESP_SYSTEM_MEMPROT_FEATURE_LOCK
  111. depends on ESP_SYSTEM_MEMPROT_FEATURE
  112. bool "Lock memory protection settings"
  113. default "y"
  114. help
  115. Once locked, memory protection settings cannot be changed anymore.
  116. The lock is reset only on the chip startup.
  117. config ESP_SYSTEM_MEMPROT_CPU_PREFETCH_PAD_SIZE
  118. # Hidden option for linker script usage
  119. int
  120. depends on ESP_SYSTEM_MEMPROT_DEPCHECK
  121. default 16
  122. config ESP_SYSTEM_MEMPROT_MEM_ALIGN_SIZE
  123. # Hidden option for linker script usage
  124. int
  125. depends on ESP_SYSTEM_MEMPROT_DEPCHECK
  126. default 4 if IDF_TARGET_ESP32S2
  127. default 256 if IDF_TARGET_ESP32S3
  128. default 512
  129. endmenu # Memory protection
  130. config ESP_SYSTEM_EVENT_QUEUE_SIZE
  131. int "System event queue size"
  132. default 32
  133. help
  134. Config system event queue size in different application.
  135. config ESP_SYSTEM_EVENT_TASK_STACK_SIZE
  136. int "Event loop task stack size"
  137. default 2304
  138. help
  139. Config system event task stack size in different application.
  140. config ESP_MAIN_TASK_STACK_SIZE
  141. int "Main task stack size"
  142. default 3584
  143. help
  144. Configure the "main task" stack size. This is the stack of the task
  145. which calls app_main(). If app_main() returns then this task is deleted
  146. and its stack memory is freed.
  147. choice ESP_MAIN_TASK_AFFINITY
  148. prompt "Main task core affinity"
  149. default ESP_MAIN_TASK_AFFINITY_CPU0
  150. help
  151. Configure the "main task" core affinity. This is the used core of the task
  152. which calls app_main(). If app_main() returns then this task is deleted.
  153. config ESP_MAIN_TASK_AFFINITY_CPU0
  154. bool "CPU0"
  155. config ESP_MAIN_TASK_AFFINITY_CPU1
  156. bool "CPU1"
  157. depends on !FREERTOS_UNICORE
  158. config ESP_MAIN_TASK_AFFINITY_NO_AFFINITY
  159. bool "No affinity"
  160. endchoice
  161. config ESP_MAIN_TASK_AFFINITY
  162. hex
  163. default 0x0 if ESP_MAIN_TASK_AFFINITY_CPU0
  164. default 0x1 if ESP_MAIN_TASK_AFFINITY_CPU1
  165. default FREERTOS_NO_AFFINITY if ESP_MAIN_TASK_AFFINITY_NO_AFFINITY
  166. config ESP_MINIMAL_SHARED_STACK_SIZE
  167. int "Minimal allowed size for shared stack"
  168. default 2048
  169. help
  170. Minimal value of size, in bytes, accepted to execute a expression
  171. with shared stack.
  172. choice ESP_CONSOLE_UART
  173. prompt "Channel for console output"
  174. default ESP_CONSOLE_UART_DEFAULT
  175. help
  176. Select where to send console output (through stdout and stderr).
  177. - Default is to use UART0 on pre-defined GPIOs.
  178. - If "Custom" is selected, UART0 or UART1 can be chosen,
  179. and any pins can be selected.
  180. - If "None" is selected, there will be no console output on any UART, except
  181. for initial output from ROM bootloader. This ROM output can be suppressed by
  182. GPIO strapping or EFUSE, refer to chip datasheet for details.
  183. - On chips with USB OTG peripheral, "USB CDC" option redirects output to the
  184. CDC port. This option uses the CDC driver in the chip ROM.
  185. This option is incompatible with TinyUSB stack.
  186. - On chips with an USB serial/JTAG debug controller, selecting the option
  187. for that redirects output to the CDC/ACM (serial port emulation) component
  188. of that device.
  189. config ESP_CONSOLE_UART_DEFAULT
  190. bool "Default: UART0"
  191. config ESP_CONSOLE_USB_CDC
  192. bool "USB CDC"
  193. # && !TINY_USB is because the ROM CDC driver is currently incompatible with TinyUSB.
  194. depends on (IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3) && !TINY_USB
  195. config ESP_CONSOLE_USB_SERIAL_JTAG
  196. bool "USB Serial/JTAG Controller"
  197. select ESPTOOLPY_NO_STUB if IDF_TARGET_ESP32S3 #ESPTOOL-251
  198. select ESPTOOLPY_NO_STUB if IDF_TARGET_ESP32C3 #ESPTOOL-252
  199. depends on IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
  200. config ESP_CONSOLE_UART_CUSTOM
  201. bool "Custom UART"
  202. config ESP_CONSOLE_NONE
  203. bool "None"
  204. endchoice
  205. choice ESP_CONSOLE_SECONDARY
  206. depends on IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C3
  207. prompt "Channel for console secondary output"
  208. default ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG
  209. help
  210. This secondary option supports output through other specific port like USB_SERIAL_JTAG
  211. when UART0 port as a primary is selected but not connected. This secondary output currently only supports
  212. non-blocking mode without using REPL. If you want to output in blocking mode with REPL or
  213. input through this secondary port, please change the primary config to this port
  214. in `Channel for console output` menu.
  215. config ESP_CONSOLE_SECONDARY_NONE
  216. bool "No secondary console"
  217. config ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG
  218. bool "USB_SERIAL_JTAG PORT"
  219. depends on !ESP_CONSOLE_USB_SERIAL_JTAG
  220. help
  221. This option supports output through USB_SERIAL_JTAG port when the UART0 port is not connected.
  222. The output currently only supports non-blocking mode without using the console.
  223. If you want to output in blocking mode with REPL or input through USB_SERIAL_JTAG port,
  224. please change the primary config to ESP_CONSOLE_USB_SERIAL_JTAG above.
  225. endchoice
  226. config ESP_CONSOLE_UART
  227. # Internal option, indicates that console UART is used (and not USB, for example)
  228. bool
  229. default y if ESP_CONSOLE_UART_DEFAULT || ESP_CONSOLE_UART_CUSTOM
  230. config ESP_CONSOLE_MULTIPLE_UART
  231. bool
  232. default y if !IDF_TARGET_ESP32C3 && !IDF_TARGET_ESP32H2
  233. choice ESP_CONSOLE_UART_NUM
  234. prompt "UART peripheral to use for console output (0-1)"
  235. depends on ESP_CONSOLE_UART_CUSTOM && ESP_CONSOLE_MULTIPLE_UART
  236. default ESP_CONSOLE_UART_CUSTOM_NUM_0
  237. help
  238. This UART peripheral is used for console output from the ESP-IDF Bootloader and the app.
  239. If the configuration is different in the Bootloader binary compared to the app binary, UART
  240. is reconfigured after the bootloader exits and the app starts.
  241. Due to an ESP32 ROM bug, UART2 is not supported for console output
  242. via esp_rom_printf.
  243. config ESP_CONSOLE_UART_CUSTOM_NUM_0
  244. bool "UART0"
  245. config ESP_CONSOLE_UART_CUSTOM_NUM_1
  246. bool "UART1"
  247. endchoice
  248. config ESP_CONSOLE_UART_NUM
  249. int
  250. default 0 if ESP_CONSOLE_UART_DEFAULT
  251. default 0 if !ESP_CONSOLE_MULTIPLE_UART
  252. default 0 if ESP_CONSOLE_UART_CUSTOM_NUM_0
  253. default 1 if ESP_CONSOLE_UART_CUSTOM_NUM_1
  254. default -1 if !ESP_CONSOLE_UART
  255. config ESP_CONSOLE_UART_TX_GPIO
  256. int "UART TX on GPIO#"
  257. depends on ESP_CONSOLE_UART_CUSTOM
  258. range 0 46
  259. default 1 if IDF_TARGET_ESP32
  260. default 21 if IDF_TARGET_ESP32C3
  261. default 43
  262. help
  263. This GPIO is used for console UART TX output in the ESP-IDF Bootloader and the app (including
  264. boot log output and default standard output and standard error of the app).
  265. If the configuration is different in the Bootloader binary compared to the app binary, UART
  266. is reconfigured after the bootloader exits and the app starts.
  267. config ESP_CONSOLE_UART_RX_GPIO
  268. int "UART RX on GPIO#"
  269. depends on ESP_CONSOLE_UART_CUSTOM
  270. range 0 46
  271. default 3 if IDF_TARGET_ESP32
  272. default 20 if IDF_TARGET_ESP32C3
  273. default 44
  274. help
  275. This GPIO is used for UART RX input in the ESP-IDF Bootloader and the app (including
  276. default default standard input of the app).
  277. Note: The default ESP-IDF Bootloader configures this pin but doesn't read anything from the UART.
  278. If the configuration is different in the Bootloader binary compared to the app binary, UART
  279. is reconfigured after the bootloader exits and the app starts.
  280. config ESP_CONSOLE_UART_BAUDRATE
  281. int
  282. prompt "UART console baud rate" if ESP_CONSOLE_UART_CUSTOM
  283. depends on ESP_CONSOLE_UART
  284. default 115200
  285. range 1200 4000000 if !PM_ENABLE
  286. range 1200 1000000 if PM_ENABLE
  287. help
  288. This baud rate is used by both the ESP-IDF Bootloader and the app (including
  289. boot log output and default standard input/output/error of the app).
  290. The app's maximum baud rate depends on the UART clock source. If Power Management is disabled,
  291. the UART clock source is the APB clock and all baud rates in the available range will be sufficiently
  292. accurate. If Power Management is enabled, REF_TICK clock source is used so the baud rate is divided
  293. from 1MHz. Baud rates above 1Mbps are not possible and values between 500Kbps and 1Mbps may not be
  294. accurate.
  295. If the configuration is different in the Bootloader binary compared to the app binary, UART
  296. is reconfigured after the bootloader exits and the app starts.
  297. config ESP_CONSOLE_USB_CDC_RX_BUF_SIZE
  298. int "Size of USB CDC RX buffer"
  299. depends on ESP_CONSOLE_USB_CDC
  300. default 64
  301. range 4 16384
  302. help
  303. Set the size of USB CDC RX buffer. Increase the buffer size if your application
  304. is often receiving data over USB CDC.
  305. config ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF
  306. bool "Enable esp_rom_printf / ESP_EARLY_LOG via USB CDC"
  307. depends on ESP_CONSOLE_USB_CDC
  308. default n
  309. help
  310. If enabled, esp_rom_printf and ESP_EARLY_LOG output will also be sent over USB CDC.
  311. Disabling this option saves about 1kB or RAM.
  312. config ESP_INT_WDT
  313. bool "Interrupt watchdog"
  314. default y
  315. help
  316. This watchdog timer can detect if the FreeRTOS tick interrupt has not been called for a certain time,
  317. either because a task turned off interrupts and did not turn them on for a long time, or because an
  318. interrupt handler did not return. It will try to invoke the panic handler first and failing that
  319. reset the SoC.
  320. config ESP_INT_WDT_TIMEOUT_MS
  321. int "Interrupt watchdog timeout (ms)"
  322. depends on ESP_INT_WDT
  323. default 300 if !ESP32_SPIRAM_SUPPORT
  324. default 800 if ESP32_SPIRAM_SUPPORT
  325. range 10 10000
  326. help
  327. The timeout of the watchdog, in miliseconds. Make this higher than the FreeRTOS tick rate.
  328. config ESP_INT_WDT_CHECK_CPU1
  329. bool "Also watch CPU1 tick interrupt"
  330. depends on ESP_INT_WDT && !FREERTOS_UNICORE
  331. default y
  332. help
  333. Also detect if interrupts on CPU 1 are disabled for too long.
  334. config ESP_TASK_WDT
  335. bool "Initialize Task Watchdog Timer on startup"
  336. default y
  337. help
  338. The Task Watchdog Timer can be used to make sure individual tasks are still
  339. running. Enabling this option will cause the Task Watchdog Timer to be
  340. initialized automatically at startup. The Task Watchdog timer can be
  341. initialized after startup as well (see Task Watchdog Timer API Reference)
  342. config ESP_TASK_WDT_PANIC
  343. bool "Invoke panic handler on Task Watchdog timeout"
  344. depends on ESP_TASK_WDT
  345. default n
  346. help
  347. If this option is enabled, the Task Watchdog Timer will be configured to
  348. trigger the panic handler when it times out. This can also be configured
  349. at run time (see Task Watchdog Timer API Reference)
  350. config ESP_TASK_WDT_TIMEOUT_S
  351. int "Task Watchdog timeout period (seconds)"
  352. depends on ESP_TASK_WDT
  353. range 1 60
  354. default 5
  355. help
  356. Timeout period configuration for the Task Watchdog Timer in seconds.
  357. This is also configurable at run time (see Task Watchdog Timer API Reference)
  358. config ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0
  359. bool "Watch CPU0 Idle Task"
  360. depends on ESP_TASK_WDT
  361. default y
  362. help
  363. If this option is enabled, the Task Watchdog Timer will watch the CPU0
  364. Idle Task. Having the Task Watchdog watch the Idle Task allows for detection
  365. of CPU starvation as the Idle Task not being called is usually a symptom of
  366. CPU starvation. Starvation of the Idle Task is detrimental as FreeRTOS household
  367. tasks depend on the Idle Task getting some runtime every now and then.
  368. config ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1
  369. bool "Watch CPU1 Idle Task"
  370. depends on ESP_TASK_WDT && !FREERTOS_UNICORE
  371. default y
  372. help
  373. If this option is enabled, the Task Wtachdog Timer will wach the CPU1
  374. Idle Task.
  375. config ESP_XT_WDT
  376. bool "Initialize XTAL32K watchdog timer on startup"
  377. depends on !IDF_TARGET_ESP32 && (ESP_SYSTEM_RTC_EXT_OSC || ESP_SYSTEM_RTC_EXT_XTAL)
  378. default n
  379. help
  380. This watchdog timer can detect oscillation failure of the XTAL32K_CLK. When such a failure
  381. is detected the hardware can be set up to automatically switch to BACKUP32K_CLK and generate
  382. an interrupt.
  383. config ESP_XT_WDT_TIMEOUT
  384. int "XTAL32K watchdog timeout period"
  385. depends on ESP_XT_WDT
  386. range 1 255
  387. default 200
  388. help
  389. Timeout period configuration for the XTAL32K watchdog timer based on RTC_CLK.
  390. config ESP_XT_WDT_BACKUP_CLK_ENABLE
  391. bool "Automatically switch to BACKUP32K_CLK when timer expires"
  392. depends on ESP_XT_WDT
  393. default y
  394. help
  395. Enable this to automatically switch to BACKUP32K_CLK as the source of RTC_SLOW_CLK when
  396. the watchdog timer expires.
  397. config ESP_PANIC_HANDLER_IRAM
  398. bool "Place panic handler code in IRAM"
  399. default n
  400. help
  401. If this option is disabled (default), the panic handler code is placed in flash not IRAM.
  402. This means that if ESP-IDF crashes while flash cache is disabled, the panic handler will
  403. automatically re-enable flash cache before running GDB Stub or Core Dump. This adds some minor
  404. risk, if the flash cache status is also corrupted during the crash.
  405. If this option is enabled, the panic handler code (including required UART functions) is placed
  406. in IRAM. This may be necessary to debug some complex issues with crashes while flash cache is
  407. disabled (for example, when writing to SPI flash) or when flash cache is corrupted when an exception
  408. is triggered.
  409. config ESP_DEBUG_STUBS_ENABLE
  410. bool "OpenOCD debug stubs"
  411. default COMPILER_OPTIMIZATION_LEVEL_DEBUG
  412. depends on !ESP32_TRAX && !ESP32S2_TRAX && !ESP32S3_TRAX
  413. help
  414. Debug stubs are used by OpenOCD to execute pre-compiled onboard code
  415. which does some useful debugging stuff, e.g. GCOV data dump.
  416. choice ESP_SYSTEM_CHECK_INT_LEVEL
  417. prompt "Interrupt level to use for Interrupt Watchdog and other system checks"
  418. default ESP_SYSTEM_CHECK_INT_LEVEL_4
  419. help
  420. Interrupt level to use for Interrupt Watchdog and other system checks.
  421. config ESP_SYSTEM_CHECK_INT_LEVEL_5
  422. bool "Level 5 interrupt"
  423. depends on IDF_TARGET_ESP32
  424. help
  425. Using level 5 interrupt for Interrupt Watchdog and other system checks.
  426. config ESP_SYSTEM_CHECK_INT_LEVEL_4
  427. bool "Level 4 interrupt"
  428. depends on !BTDM_CTRL_HLI
  429. help
  430. Using level 4 interrupt for Interrupt Watchdog and other system checks.
  431. endchoice
  432. endmenu # ESP System Settings