Kconfig 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  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. # Internal option, indicates that console UART is used (and not USB, for example)
  206. config ESP_CONSOLE_UART
  207. bool
  208. default y if ESP_CONSOLE_UART_DEFAULT || ESP_CONSOLE_UART_CUSTOM
  209. config ESP_CONSOLE_MULTIPLE_UART
  210. bool
  211. default y if !IDF_TARGET_ESP32C3 && !IDF_TARGET_ESP32H2
  212. choice ESP_CONSOLE_UART_NUM
  213. prompt "UART peripheral to use for console output (0-1)"
  214. depends on ESP_CONSOLE_UART_CUSTOM && ESP_CONSOLE_MULTIPLE_UART
  215. default ESP_CONSOLE_UART_CUSTOM_NUM_0
  216. help
  217. This UART peripheral is used for console output from the ESP-IDF Bootloader and the app.
  218. If the configuration is different in the Bootloader binary compared to the app binary, UART
  219. is reconfigured after the bootloader exits and the app starts.
  220. Due to an ESP32 ROM bug, UART2 is not supported for console output
  221. via esp_rom_printf.
  222. config ESP_CONSOLE_UART_CUSTOM_NUM_0
  223. bool "UART0"
  224. config ESP_CONSOLE_UART_CUSTOM_NUM_1
  225. bool "UART1"
  226. endchoice
  227. config ESP_CONSOLE_UART_NUM
  228. int
  229. default 0 if ESP_CONSOLE_UART_DEFAULT
  230. default 0 if !ESP_CONSOLE_MULTIPLE_UART
  231. default 0 if ESP_CONSOLE_UART_CUSTOM_NUM_0
  232. default 1 if ESP_CONSOLE_UART_CUSTOM_NUM_1
  233. default -1 if !ESP_CONSOLE_UART
  234. config ESP_CONSOLE_UART_TX_GPIO
  235. int "UART TX on GPIO#"
  236. depends on ESP_CONSOLE_UART_CUSTOM
  237. range 0 46
  238. default 1 if IDF_TARGET_ESP32
  239. default 21 if IDF_TARGET_ESP32C3
  240. default 43
  241. help
  242. This GPIO is used for console UART TX output in the ESP-IDF Bootloader and the app (including
  243. boot log output and default standard output and standard error of the app).
  244. If the configuration is different in the Bootloader binary compared to the app binary, UART
  245. is reconfigured after the bootloader exits and the app starts.
  246. config ESP_CONSOLE_UART_RX_GPIO
  247. int "UART RX on GPIO#"
  248. depends on ESP_CONSOLE_UART_CUSTOM
  249. range 0 46
  250. default 3 if IDF_TARGET_ESP32
  251. default 20 if IDF_TARGET_ESP32C3
  252. default 44
  253. help
  254. This GPIO is used for UART RX input in the ESP-IDF Bootloader and the app (including
  255. default default standard input of the app).
  256. Note: The default ESP-IDF Bootloader configures this pin but doesn't read anything from the UART.
  257. If the configuration is different in the Bootloader binary compared to the app binary, UART
  258. is reconfigured after the bootloader exits and the app starts.
  259. config ESP_CONSOLE_UART_BAUDRATE
  260. int
  261. prompt "UART console baud rate" if ESP_CONSOLE_UART_CUSTOM
  262. depends on ESP_CONSOLE_UART
  263. default 115200
  264. range 1200 4000000 if !PM_ENABLE
  265. range 1200 1000000 if PM_ENABLE
  266. help
  267. This baud rate is used by both the ESP-IDF Bootloader and the app (including
  268. boot log output and default standard input/output/error of the app).
  269. The app's maximum baud rate depends on the UART clock source. If Power Management is disabled,
  270. the UART clock source is the APB clock and all baud rates in the available range will be sufficiently
  271. accurate. If Power Management is enabled, REF_TICK clock source is used so the baud rate is divided
  272. from 1MHz. Baud rates above 1Mbps are not possible and values between 500Kbps and 1Mbps may not be
  273. accurate.
  274. If the configuration is different in the Bootloader binary compared to the app binary, UART
  275. is reconfigured after the bootloader exits and the app starts.
  276. config ESP_CONSOLE_USB_CDC_RX_BUF_SIZE
  277. int "Size of USB CDC RX buffer"
  278. depends on ESP_CONSOLE_USB_CDC
  279. default 64
  280. range 4 16384
  281. help
  282. Set the size of USB CDC RX buffer. Increase the buffer size if your application
  283. is often receiving data over USB CDC.
  284. config ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF
  285. bool "Enable esp_rom_printf / ESP_EARLY_LOG via USB CDC"
  286. depends on ESP_CONSOLE_USB_CDC
  287. default n
  288. help
  289. If enabled, esp_rom_printf and ESP_EARLY_LOG output will also be sent over USB CDC.
  290. Disabling this option saves about 1kB or RAM.
  291. config ESP_INT_WDT
  292. bool "Interrupt watchdog"
  293. default y
  294. help
  295. This watchdog timer can detect if the FreeRTOS tick interrupt has not been called for a certain time,
  296. either because a task turned off interrupts and did not turn them on for a long time, or because an
  297. interrupt handler did not return. It will try to invoke the panic handler first and failing that
  298. reset the SoC.
  299. config ESP_INT_WDT_TIMEOUT_MS
  300. int "Interrupt watchdog timeout (ms)"
  301. depends on ESP_INT_WDT
  302. default 300 if !ESP32_SPIRAM_SUPPORT
  303. default 800 if ESP32_SPIRAM_SUPPORT
  304. range 10 10000
  305. help
  306. The timeout of the watchdog, in miliseconds. Make this higher than the FreeRTOS tick rate.
  307. config ESP_INT_WDT_CHECK_CPU1
  308. bool "Also watch CPU1 tick interrupt"
  309. depends on ESP_INT_WDT && !FREERTOS_UNICORE
  310. default y
  311. help
  312. Also detect if interrupts on CPU 1 are disabled for too long.
  313. config ESP_TASK_WDT
  314. bool "Initialize Task Watchdog Timer on startup"
  315. default y
  316. help
  317. The Task Watchdog Timer can be used to make sure individual tasks are still
  318. running. Enabling this option will cause the Task Watchdog Timer to be
  319. initialized automatically at startup. The Task Watchdog timer can be
  320. initialized after startup as well (see Task Watchdog Timer API Reference)
  321. config ESP_TASK_WDT_PANIC
  322. bool "Invoke panic handler on Task Watchdog timeout"
  323. depends on ESP_TASK_WDT
  324. default n
  325. help
  326. If this option is enabled, the Task Watchdog Timer will be configured to
  327. trigger the panic handler when it times out. This can also be configured
  328. at run time (see Task Watchdog Timer API Reference)
  329. config ESP_TASK_WDT_TIMEOUT_S
  330. int "Task Watchdog timeout period (seconds)"
  331. depends on ESP_TASK_WDT
  332. range 1 60
  333. default 5
  334. help
  335. Timeout period configuration for the Task Watchdog Timer in seconds.
  336. This is also configurable at run time (see Task Watchdog Timer API Reference)
  337. config ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0
  338. bool "Watch CPU0 Idle Task"
  339. depends on ESP_TASK_WDT
  340. default y
  341. help
  342. If this option is enabled, the Task Watchdog Timer will watch the CPU0
  343. Idle Task. Having the Task Watchdog watch the Idle Task allows for detection
  344. of CPU starvation as the Idle Task not being called is usually a symptom of
  345. CPU starvation. Starvation of the Idle Task is detrimental as FreeRTOS household
  346. tasks depend on the Idle Task getting some runtime every now and then.
  347. config ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1
  348. bool "Watch CPU1 Idle Task"
  349. depends on ESP_TASK_WDT && !FREERTOS_UNICORE
  350. default y
  351. help
  352. If this option is enabled, the Task Wtachdog Timer will wach the CPU1
  353. Idle Task.
  354. config ESP_XT_WDT
  355. bool "Initialize XTAL32K watchdog timer on startup"
  356. depends on !IDF_TARGET_ESP32 && (ESP_SYSTEM_RTC_EXT_OSC || ESP_SYSTEM_RTC_EXT_XTAL)
  357. default n
  358. help
  359. This watchdog timer can detect oscillation failure of the XTAL32K_CLK. When such a failure
  360. is detected the hardware can be set up to automatically switch to BACKUP32K_CLK and generate
  361. an interrupt.
  362. config ESP_XT_WDT_TIMEOUT
  363. int "XTAL32K watchdog timeout period"
  364. depends on ESP_XT_WDT
  365. range 1 255
  366. default 200
  367. help
  368. Timeout period configuration for the XTAL32K watchdog timer based on RTC_CLK.
  369. config ESP_XT_WDT_BACKUP_CLK_ENABLE
  370. bool "Automatically switch to BACKUP32K_CLK when timer expires"
  371. depends on ESP_XT_WDT
  372. default y
  373. help
  374. Enable this to automatically switch to BACKUP32K_CLK as the source of RTC_SLOW_CLK when
  375. the watchdog timer expires.
  376. config ESP_PANIC_HANDLER_IRAM
  377. bool "Place panic handler code in IRAM"
  378. default n
  379. help
  380. If this option is disabled (default), the panic handler code is placed in flash not IRAM.
  381. This means that if ESP-IDF crashes while flash cache is disabled, the panic handler will
  382. automatically re-enable flash cache before running GDB Stub or Core Dump. This adds some minor
  383. risk, if the flash cache status is also corrupted during the crash.
  384. If this option is enabled, the panic handler code (including required UART functions) is placed
  385. in IRAM. This may be necessary to debug some complex issues with crashes while flash cache is
  386. disabled (for example, when writing to SPI flash) or when flash cache is corrupted when an exception
  387. is triggered.
  388. config ESP_DEBUG_STUBS_ENABLE
  389. bool
  390. default COMPILER_OPTIMIZATION_LEVEL_DEBUG
  391. depends on !ESP32_TRAX && !ESP32S2_TRAX
  392. help
  393. Debug stubs are used by OpenOCD to execute pre-compiled onboard code
  394. which does some useful debugging stuff, e.g. GCOV data dump.
  395. choice ESP_SYSTEM_CHECK_INT_LEVEL
  396. prompt "Interrupt level to use for Interrupt Watchdog and other system checks"
  397. default ESP_SYSTEM_CHECK_INT_LEVEL_4
  398. help
  399. Interrupt level to use for Interrupt Watchdog and other system checks.
  400. config ESP_SYSTEM_CHECK_INT_LEVEL_5
  401. bool "Level 5 interrupt"
  402. depends on IDF_TARGET_ESP32
  403. help
  404. Using level 5 interrupt for Interrupt Watchdog and other system checks.
  405. config ESP_SYSTEM_CHECK_INT_LEVEL_4
  406. bool "Level 4 interrupt"
  407. depends on !BTDM_CTRL_HLI
  408. help
  409. Using level 4 interrupt for Interrupt Watchdog and other system checks.
  410. endchoice
  411. endmenu # ESP System Settings