Kconfig 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. #
  2. # Please run the following command for opening a page with more information about this configuration file:
  3. # idf.py docs -sp api-reference/kconfig.html
  4. #
  5. mainmenu "Espressif IoT Development Framework Configuration"
  6. orsource "./components/soc/$IDF_TARGET/include/soc/Kconfig.soc_caps.in"
  7. config IDF_CMAKE
  8. bool
  9. default "y"
  10. config IDF_ENV_FPGA
  11. # This option is for internal use only
  12. bool
  13. option env="IDF_ENV_FPGA"
  14. config IDF_CI_BUILD
  15. bool
  16. default y if "$(IDF_CI_BUILD)" = "y" || "$(IDF_CI_BUILD)" = 1
  17. config IDF_TARGET_ARCH_RISCV
  18. bool
  19. default "n"
  20. config IDF_TARGET_ARCH_XTENSA
  21. bool
  22. default "n"
  23. config IDF_TARGET_ARCH
  24. string
  25. default "riscv" if IDF_TARGET_ARCH_RISCV
  26. default "xtensa" if IDF_TARGET_ARCH_XTENSA
  27. config IDF_TARGET
  28. # This option records the IDF target when sdkconfig is generated the first time.
  29. # It is not updated if environment variable $IDF_TARGET changes later, and
  30. # the build system is responsible for detecting the mismatch between
  31. # CONFIG_IDF_TARGET and $IDF_TARGET.
  32. string
  33. default "$IDF_TARGET"
  34. config IDF_TARGET_LINUX
  35. bool
  36. default "y" if IDF_TARGET="linux"
  37. config IDF_TARGET_ESP32
  38. bool
  39. default "y" if IDF_TARGET="esp32"
  40. select IDF_TARGET_ARCH_XTENSA
  41. config IDF_TARGET_ESP32S2
  42. bool
  43. default "y" if IDF_TARGET="esp32s2"
  44. select FREERTOS_UNICORE
  45. select IDF_TARGET_ARCH_XTENSA
  46. config IDF_TARGET_ESP32S3
  47. bool
  48. default "y" if IDF_TARGET="esp32s3"
  49. select IDF_TARGET_ARCH_XTENSA
  50. config IDF_TARGET_ESP32C3
  51. bool
  52. default "y" if IDF_TARGET="esp32c3"
  53. select FREERTOS_UNICORE
  54. select IDF_TARGET_ARCH_RISCV
  55. config IDF_TARGET_ESP32H4
  56. bool
  57. default "y" if IDF_TARGET="esp32h4"
  58. select FREERTOS_UNICORE
  59. select IDF_TARGET_ARCH_RISCV
  60. choice IDF_TARGET_ESP32H4_BETA_VERSION
  61. prompt "ESP32-H4 beta version"
  62. depends on IDF_TARGET_ESP32H4
  63. default IDF_TARGET_ESP32H4_BETA_VERSION_2
  64. help
  65. Currently ESP32-H4 has several beta versions for internal use only.
  66. Select the one that matches your chip model.
  67. config IDF_TARGET_ESP32H4_BETA_VERSION_1
  68. bool
  69. prompt "ESP32-H4 beta1"
  70. config IDF_TARGET_ESP32H4_BETA_VERSION_2
  71. bool
  72. prompt "ESP32-H4 beta2"
  73. endchoice
  74. config IDF_TARGET_ESP32C2
  75. bool
  76. default "y" if IDF_TARGET="esp32c2"
  77. select FREERTOS_UNICORE
  78. select IDF_TARGET_ARCH_RISCV
  79. config IDF_TARGET_ESP32C6
  80. bool
  81. default "y" if IDF_TARGET="esp32c6"
  82. select FREERTOS_UNICORE
  83. select IDF_TARGET_ARCH_RISCV
  84. config IDF_TARGET_ESP32H2
  85. bool
  86. default "y" if IDF_TARGET="esp32h2"
  87. select FREERTOS_UNICORE
  88. select IDF_TARGET_ARCH_RISCV
  89. config IDF_TARGET_LINUX
  90. bool
  91. default "y" if IDF_TARGET="linux"
  92. config IDF_FIRMWARE_CHIP_ID
  93. hex
  94. default 0x0000 if IDF_TARGET_ESP32
  95. default 0x0002 if IDF_TARGET_ESP32S2
  96. default 0x0005 if IDF_TARGET_ESP32C3
  97. default 0x0009 if IDF_TARGET_ESP32S3
  98. default 0x000A if IDF_TARGET_ESP32H4_BETA_VERSION_1
  99. default 0x000C if IDF_TARGET_ESP32C2
  100. default 0x000D if IDF_TARGET_ESP32C6
  101. default 0x000E if IDF_TARGET_ESP32H4_BETA_VERSION_2 # ESP32-TODO: IDF-3475
  102. default 0x0010 if IDF_TARGET_ESP32H2
  103. default 0xFFFF
  104. menu "Build type"
  105. choice APP_BUILD_TYPE
  106. prompt "Application build type"
  107. default APP_BUILD_TYPE_APP_2NDBOOT
  108. help
  109. Select the way the application is built.
  110. By default, the application is built as a binary file in a format compatible with
  111. the ESP-IDF bootloader. In addition to this application, 2nd stage bootloader is
  112. also built. Application and bootloader binaries can be written into flash and
  113. loaded/executed from there.
  114. Another option, useful for only very small and limited applications, is to only link
  115. the .elf file of the application, such that it can be loaded directly into RAM over
  116. JTAG or UART. Note that since IRAM and DRAM sizes are very limited, it is not possible
  117. to build any complex application this way. However for some kinds of testing and debugging,
  118. this option may provide faster iterations, since the application does not need to be
  119. written into flash.
  120. Note: when APP_BUILD_TYPE_RAM is selected and loaded with JTAG, ESP-IDF does not contain
  121. all the startup code required to initialize the CPUs and ROM memory (data/bss).
  122. Therefore it is necessary to execute a bit of ROM code prior to executing the application.
  123. A gdbinit file may look as follows (for ESP32):
  124. # Connect to a running instance of OpenOCD
  125. target remote :3333
  126. # Reset and halt the target
  127. mon reset halt
  128. # Run to a specific point in ROM code,
  129. # where most of initialization is complete.
  130. thb *0x40007d54
  131. c
  132. # Load the application into RAM
  133. load
  134. # Run till app_main
  135. tb app_main
  136. c
  137. Execute this gdbinit file as follows:
  138. xtensa-esp32-elf-gdb build/app-name.elf -x gdbinit
  139. Example gdbinit files for other targets can be found in tools/test_apps/system/gdb_loadable_elf/
  140. When loading the BIN with UART, the ROM will jump to ram and run the app after finishing the ROM
  141. startup code, so there's no additional startup initialization required. You can use the
  142. `load_ram` in esptool.py to load the generated .bin file into ram and execute.
  143. Example:
  144. esptool.py --chip {chip} -p {port} -b {baud} --no-stub load_ram {app.bin}
  145. Recommended sdkconfig.defaults for building loadable ELF files is as follows.
  146. CONFIG_APP_BUILD_TYPE_RAM is required, other options help reduce application
  147. memory footprint.
  148. CONFIG_APP_BUILD_TYPE_RAM=y
  149. CONFIG_VFS_SUPPORT_TERMIOS=
  150. CONFIG_NEWLIB_NANO_FORMAT=y
  151. CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y
  152. CONFIG_ESP_DEBUG_STUBS_ENABLE=
  153. CONFIG_ESP_ERR_TO_NAME_LOOKUP=
  154. config APP_BUILD_TYPE_APP_2NDBOOT
  155. bool
  156. prompt "Default (binary application + 2nd stage bootloader)"
  157. depends on !IDF_TARGET_LINUX
  158. select APP_BUILD_GENERATE_BINARIES
  159. select APP_BUILD_BOOTLOADER
  160. select APP_BUILD_USE_FLASH_SECTIONS
  161. config APP_BUILD_TYPE_RAM
  162. bool
  163. prompt "Build app runs entirely in RAM (EXPERIMENTAL)"
  164. select APP_BUILD_GENERATE_BINARIES
  165. endchoice # APP_BUILD_TYPE
  166. # Hidden options, set according to the choice above
  167. config APP_BUILD_GENERATE_BINARIES
  168. bool # Whether to generate .bin files or not
  169. config APP_BUILD_BOOTLOADER
  170. bool # Whether to build the bootloader
  171. config APP_BUILD_TYPE_PURE_RAM_APP
  172. bool
  173. prompt "Build app without SPI_FLASH/PSRAM support (saves ram)"
  174. depends on APP_BUILD_TYPE_RAM
  175. help
  176. If this option is enabled, external memory and related peripherals, such as Cache, MMU,
  177. Flash and PSRAM, won't be initialized. Corresponding drivers won't be introduced either.
  178. Components that depend on the spi_flash component will also be unavailable, such as
  179. app_update, etc. When this option is enabled, about 26KB of RAM space can be saved.
  180. config APP_BUILD_USE_FLASH_SECTIONS
  181. bool # Whether to place code/data into memory-mapped flash sections
  182. config APP_REPRODUCIBLE_BUILD
  183. bool "Enable reproducible build"
  184. default n
  185. select COMPILER_HIDE_PATHS_MACROS
  186. help
  187. If enabled, all date, time, and path information would be eliminated. A .gdbinit file would be create
  188. automatically. (or will be append if you have one already)
  189. config APP_NO_BLOBS
  190. bool "No Binary Blobs"
  191. default n
  192. help
  193. If enabled, this disables the linking of binary libraries in the application build. Note
  194. that after enabling this Wi-Fi/Bluetooth will not work.
  195. config APP_COMPATIBLE_PRE_V2_1_BOOTLOADERS
  196. bool "App compatible with bootloaders before ESP-IDF v2.1"
  197. select APP_COMPATIBLE_PRE_V3_1_BOOTLOADERS
  198. depends on IDF_TARGET_ESP32
  199. default n
  200. help
  201. Bootloaders before ESP-IDF v2.1 did less initialisation of the
  202. system clock. This setting needs to be enabled to build an app
  203. which can be booted by these older bootloaders.
  204. If this setting is enabled, the app can be booted by any bootloader
  205. from IDF v1.0 up to the current version.
  206. If this setting is disabled, the app can only be booted by bootloaders
  207. from IDF v2.1 or newer.
  208. Enabling this setting adds approximately 1KB to the app's IRAM usage.
  209. config APP_COMPATIBLE_PRE_V3_1_BOOTLOADERS
  210. bool "App compatible with bootloader and partition table before ESP-IDF v3.1"
  211. depends on IDF_TARGET_ESP32
  212. default n
  213. help
  214. Partition tables before ESP-IDF V3.1 do not contain an MD5 checksum
  215. field, and the bootloader before ESP-IDF v3.1 cannot read a partition
  216. table that contains an MD5 checksum field.
  217. Enable this option only if your app needs to boot on a bootloader and/or
  218. partition table that was generated from a version *before* ESP-IDF v3.1.
  219. If this option and Flash Encryption are enabled at the same time, and any
  220. data partitions in the partition table are marked Encrypted, then the
  221. partition encrypted flag should be manually verified in the app before accessing
  222. the partition (see CVE-2021-27926).
  223. config APP_INIT_CLK
  224. bool
  225. depends on IDF_TARGET_ESP32
  226. default y if APP_COMPATIBLE_PRE_V2_1_BOOTLOADERS
  227. default y if APP_BUILD_TYPE_RAM
  228. endmenu # Build type
  229. source "$COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE"
  230. menu "Compiler options"
  231. choice COMPILER_OPTIMIZATION
  232. prompt "Optimization Level"
  233. default COMPILER_OPTIMIZATION_DEFAULT
  234. help
  235. This option sets compiler optimization level (gcc -O argument) for the app.
  236. - The "Default" setting will add the -0g flag to CFLAGS.
  237. - The "Size" setting will add the -0s flag to CFLAGS.
  238. - The "Performance" setting will add the -O2 flag to CFLAGS.
  239. - The "None" setting will add the -O0 flag to CFLAGS.
  240. The "Size" setting cause the compiled code to be smaller and faster, but
  241. may lead to difficulties of correlating code addresses to source file
  242. lines when debugging.
  243. The "Performance" setting causes the compiled code to be larger and faster,
  244. but will be easier to correlated code addresses to source file lines.
  245. "None" with -O0 produces compiled code without optimization.
  246. Note that custom optimization levels may be unsupported.
  247. Compiler optimization for the IDF bootloader is set separately,
  248. see the BOOTLOADER_COMPILER_OPTIMIZATION setting.
  249. config COMPILER_OPTIMIZATION_DEFAULT
  250. bool "Debug (-Og)"
  251. config COMPILER_OPTIMIZATION_SIZE
  252. bool "Optimize for size (-Os)"
  253. config COMPILER_OPTIMIZATION_PERF
  254. bool "Optimize for performance (-O2)"
  255. config COMPILER_OPTIMIZATION_NONE
  256. bool "Debug without optimization (-O0)"
  257. endchoice
  258. choice COMPILER_OPTIMIZATION_ASSERTION_LEVEL
  259. prompt "Assertion level"
  260. default COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
  261. help
  262. Assertions can be:
  263. - Enabled. Failure will print verbose assertion details. This is the default.
  264. - Set to "silent" to save code size (failed assertions will abort() but user
  265. needs to use the aborting address to find the line number with the failed assertion.)
  266. - Disabled entirely (not recommended for most configurations.) -DNDEBUG is added
  267. to CPPFLAGS in this case.
  268. config COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
  269. prompt "Enabled"
  270. bool
  271. help
  272. Enable assertions. Assertion content and line number will be printed on failure.
  273. config COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
  274. prompt "Silent (saves code size)"
  275. bool
  276. help
  277. Enable silent assertions. Failed assertions will abort(), user needs to
  278. use the aborting address to find the line number with the failed assertion.
  279. config COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
  280. prompt "Disabled (sets -DNDEBUG)"
  281. bool
  282. help
  283. If assertions are disabled, -DNDEBUG is added to CPPFLAGS.
  284. endchoice # assertions
  285. choice COMPILER_FLOAT_LIB_FROM
  286. prompt "Compiler float lib source"
  287. default COMPILER_FLOAT_LIB_FROM_RVFPLIB if ESP_ROM_HAS_RVFPLIB
  288. default COMPILER_FLOAT_LIB_FROM_GCCLIB
  289. help
  290. In the soft-fp part of libgcc, riscv version is written in C,
  291. and handles all edge cases in IEEE754, which makes it larger
  292. and performance is slow.
  293. RVfplib is an optimized RISC-V library for FP arithmetic on 32-bit
  294. integer processors, for single and double-precision FP.
  295. RVfplib is "fast", but it has a few exceptions from IEEE 754 compliance.
  296. config COMPILER_FLOAT_LIB_FROM_GCCLIB
  297. bool "libgcc"
  298. config COMPILER_FLOAT_LIB_FROM_RVFPLIB
  299. depends on ESP_ROM_HAS_RVFPLIB
  300. bool "librvfp"
  301. endchoice # COMPILER_FLOAT_LIB_FROM
  302. config COMPILER_OPTIMIZATION_ASSERTION_LEVEL
  303. int
  304. default 0 if COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
  305. default 1 if COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
  306. default 2 if COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
  307. config COMPILER_OPTIMIZATION_CHECKS_SILENT
  308. bool "Disable messages in ESP_RETURN_ON_* and ESP_EXIT_ON_* macros"
  309. default n
  310. help
  311. If enabled, the error messages will be discarded in following check macros:
  312. - ESP_RETURN_ON_ERROR
  313. - ESP_EXIT_ON_ERROR
  314. - ESP_RETURN_ON_FALSE
  315. - ESP_EXIT_ON_FALSE
  316. menuconfig COMPILER_HIDE_PATHS_MACROS
  317. bool "Replace ESP-IDF and project paths in binaries"
  318. default y
  319. help
  320. When expanding the __FILE__ and __BASE_FILE__ macros, replace paths inside ESP-IDF
  321. with paths relative to the placeholder string "IDF", and convert paths inside the
  322. project directory to relative paths.
  323. This allows building the project with assertions or other code that embeds file paths,
  324. without the binary containing the exact path to the IDF or project directories.
  325. This option passes -fmacro-prefix-map options to the GCC command line. To replace additional
  326. paths in your binaries, modify the project CMakeLists.txt file to pass custom -fmacro-prefix-map or
  327. -ffile-prefix-map arguments.
  328. menuconfig COMPILER_CXX_EXCEPTIONS
  329. bool "Enable C++ exceptions"
  330. default n
  331. help
  332. Enabling this option compiles all IDF C++ files with exception support enabled.
  333. Disabling this option disables C++ exception support in all compiled files, and any libstdc++ code
  334. which throws an exception will abort instead.
  335. Enabling this option currently adds an additional ~500 bytes of heap overhead
  336. when an exception is thrown in user code for the first time.
  337. config COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE
  338. int "Emergency Pool Size"
  339. default 0
  340. depends on COMPILER_CXX_EXCEPTIONS
  341. help
  342. Size (in bytes) of the emergency memory pool for C++ exceptions. This pool will be used to allocate
  343. memory for thrown exceptions when there is not enough memory on the heap.
  344. config COMPILER_CXX_RTTI
  345. bool "Enable C++ run-time type info (RTTI)"
  346. default n
  347. help
  348. Enabling this option compiles all C++ files with RTTI support enabled.
  349. This increases binary size (typically by tens of kB) but allows using
  350. dynamic_cast conversion and typeid operator.
  351. choice COMPILER_STACK_CHECK_MODE
  352. prompt "Stack smashing protection mode"
  353. default COMPILER_STACK_CHECK_MODE_NONE
  354. help
  355. Stack smashing protection mode. Emit extra code to check for buffer overflows, such as stack
  356. smashing attacks. This is done by adding a guard variable to functions with vulnerable objects.
  357. The guards are initialized when a function is entered and then checked when the function exits.
  358. If a guard check fails, program is halted. Protection has the following modes:
  359. - In NORMAL mode (GCC flag: -fstack-protector) only functions that call alloca, and functions with
  360. buffers larger than 8 bytes are protected.
  361. - STRONG mode (GCC flag: -fstack-protector-strong) is like NORMAL, but includes additional functions
  362. to be protected -- those that have local array definitions, or have references to local frame
  363. addresses.
  364. - In OVERALL mode (GCC flag: -fstack-protector-all) all functions are protected.
  365. Modes have the following impact on code performance and coverage:
  366. - performance: NORMAL > STRONG > OVERALL
  367. - coverage: NORMAL < STRONG < OVERALL
  368. The performance impact includes increasing the amount of stack memory required for each task.
  369. config COMPILER_STACK_CHECK_MODE_NONE
  370. bool "None"
  371. config COMPILER_STACK_CHECK_MODE_NORM
  372. bool "Normal"
  373. config COMPILER_STACK_CHECK_MODE_STRONG
  374. bool "Strong"
  375. config COMPILER_STACK_CHECK_MODE_ALL
  376. bool "Overall"
  377. endchoice
  378. config COMPILER_STACK_CHECK
  379. bool
  380. default !COMPILER_STACK_CHECK_MODE_NONE
  381. help
  382. Stack smashing protection.
  383. config COMPILER_WARN_WRITE_STRINGS
  384. bool "Enable -Wwrite-strings warning flag"
  385. default "n"
  386. help
  387. Adds -Wwrite-strings flag for the C/C++ compilers.
  388. For C, this gives string constants the type ``const char[]`` so that
  389. copying the address of one into a non-const ``char *`` pointer
  390. produces a warning. This warning helps to find at compile time code
  391. that tries to write into a string constant.
  392. For C++, this warns about the deprecated conversion from string
  393. literals to ``char *``.
  394. config COMPILER_SAVE_RESTORE_LIBCALLS
  395. bool "Enable -msave-restore flag to reduce code size"
  396. depends on IDF_TARGET_ARCH_RISCV
  397. help
  398. Adds -msave-restore to C/C++ compilation flags.
  399. When this flag is enabled, compiler will call library functions to
  400. save/restore registers in function prologues/epilogues. This results
  401. in lower overall code size, at the expense of slightly reduced performance.
  402. This option can be enabled for RISC-V targets only.
  403. config COMPILER_DISABLE_GCC12_WARNINGS
  404. bool "Disable new warnings introduced in GCC 12"
  405. default "n"
  406. help
  407. Enable this option if use GCC 12 or newer, and want to disable warnings which don't appear with
  408. GCC 11.
  409. config COMPILER_DUMP_RTL_FILES
  410. bool "Dump RTL files during compilation"
  411. help
  412. If enabled, RTL files will be produced during compilation. These files
  413. can be used by other tools, for example to calculate call graphs.
  414. endmenu # Compiler Options
  415. menu "Component config"
  416. source "$COMPONENT_KCONFIGS_SOURCE_FILE"
  417. endmenu
  418. config IDF_EXPERIMENTAL_FEATURES
  419. bool "Make experimental features visible"
  420. default "n"
  421. help
  422. By enabling this option, ESP-IDF experimental feature options will be visible.
  423. Note you should still enable a certain experimental feature option to use it, and you
  424. should read the corresponding risk warning and known issue list carefully.