Kconfig 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. #
  2. # For a description of the syntax of this configuration file,
  3. # see kconfig/kconfig-language.txt.
  4. #
  5. mainmenu "Espressif IoT Development Framework Configuration"
  6. config IDF_CMAKE
  7. bool
  8. option env="IDF_CMAKE"
  9. config IDF_ENV_FPGA
  10. # This option is for internal use only
  11. bool
  12. option env="IDF_ENV_FPGA"
  13. config IDF_TARGET_ARCH_RISCV
  14. bool
  15. default "n"
  16. config IDF_TARGET_ARCH_XTENSA
  17. bool
  18. default "n"
  19. config IDF_TARGET
  20. # This option records the IDF target when sdkconfig is generated the first time.
  21. # It is not updated if environment variable $IDF_TARGET changes later, and
  22. # the build system is responsible for detecting the mismatch between
  23. # CONFIG_IDF_TARGET and $IDF_TARGET.
  24. string
  25. default "$IDF_TARGET"
  26. config IDF_TARGET_ESP32
  27. bool
  28. default "y" if IDF_TARGET="esp32"
  29. select IDF_TARGET_ARCH_XTENSA
  30. config IDF_TARGET_ESP32S2
  31. bool
  32. default "y" if IDF_TARGET="esp32s2"
  33. select FREERTOS_UNICORE
  34. select IDF_TARGET_ARCH_XTENSA
  35. config IDF_TARGET_ESP32S3
  36. bool
  37. default "y" if IDF_TARGET="esp32s3"
  38. select IDF_TARGET_ARCH_XTENSA
  39. config IDF_TARGET_ESP32C3
  40. bool
  41. default "y" if IDF_TARGET="esp32c3"
  42. select FREERTOS_UNICORE
  43. select IDF_TARGET_ARCH_RISCV
  44. config IDF_TARGET_ESP32H2
  45. bool
  46. default "y" if IDF_TARGET="esp32h2"
  47. select FREERTOS_UNICORE
  48. select IDF_TARGET_ARCH_RISCV
  49. config IDF_TARGET_LINUX
  50. bool
  51. default "y" if IDF_TARGET="linux"
  52. config IDF_FIRMWARE_CHIP_ID
  53. hex
  54. default 0x0000 if IDF_TARGET_ESP32
  55. default 0x0002 if IDF_TARGET_ESP32S2
  56. default 0x0005 if IDF_TARGET_ESP32C3
  57. default 0x0009 if IDF_TARGET_ESP32S3
  58. default 0x000A if IDF_TARGET_ESP32H2 # ESP32H2-TODO: IDF-3475
  59. default 0xFFFF
  60. menu "SDK tool configuration"
  61. config SDK_TOOLPREFIX
  62. string "Compiler toolchain path/prefix"
  63. default "xtensa-esp32-elf-" if IDF_TARGET_ESP32
  64. default "xtensa-esp32s2-elf-" if IDF_TARGET_ESP32S2
  65. default "xtensa-esp32s3-elf-" if IDF_TARGET_ESP32S3
  66. default "riscv32-esp-elf-" if IDF_TARGET_ESP32C3
  67. default "riscv32-esp-elf-" if IDF_TARGET_ESP32H2
  68. help
  69. The prefix/path that is used to call the toolchain. The default setting assumes
  70. a crosstool-ng gcc setup that is in your PATH.
  71. config SDK_PYTHON
  72. string "Python interpreter"
  73. depends on !IDF_CMAKE
  74. default "python"
  75. help
  76. The executable name/path that is used to run python.
  77. (Note: This option is used with the legacy GNU Make build system only.)
  78. config SDK_MAKE_WARN_UNDEFINED_VARIABLES
  79. bool "'make' warns on undefined variables"
  80. depends on !IDF_CMAKE
  81. default "y"
  82. help
  83. Adds --warn-undefined-variables to MAKEFLAGS. This causes make to
  84. print a warning any time an undefined variable is referenced.
  85. This option helps find places where a variable reference is misspelled
  86. or otherwise missing, but it can be unwanted if you have Makefiles which
  87. depend on undefined variables expanding to an empty string.
  88. (Note: this option is used with the legacy GNU Make build system only.)
  89. config SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS
  90. bool "Toolchain supports time_t wide 64-bits"
  91. default n
  92. help
  93. Enable this option in case you have a custom toolchain which supports time_t wide 64-bits.
  94. This option checks time_t is 64-bits and disables ROM time functions
  95. to use the time functions from the toolchain instead.
  96. This option allows resolving the Y2K38 problem.
  97. See "Setup Linux Toolchain from Scratch" to build
  98. a custom toolchain which supports 64-bits time_t.
  99. Note: ESP-IDF does not currently come with any pre-compiled toolchain
  100. that supports 64-bit wide time_t.
  101. This will change in a future major release,
  102. but currently 64-bit time_t requires a custom built toolchain.
  103. endmenu # SDK tool configuration
  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. Note that since IRAM and DRAM sizes are very limited, it is not possible to
  117. build any complex application this way. However for 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 that at the moment, ESP-IDF does not contain all the startup code required to
  121. initialize the CPUs and ROM memory (data/bss). Therefore it is necessary to execute
  122. a bit of ROM code prior to executing the application. A gdbinit file may look as follows (for ESP32):
  123. # Connect to a running instance of OpenOCD
  124. target remote :3333
  125. # Reset and halt the target
  126. mon reset halt
  127. # Run to a specific point in ROM code,
  128. # where most of initialization is complete.
  129. thb *0x40007d54
  130. c
  131. # Load the application into RAM
  132. load
  133. # Run till app_main
  134. tb app_main
  135. c
  136. Execute this gdbinit file as follows:
  137. xtensa-esp32-elf-gdb build/app-name.elf -x gdbinit
  138. Example gdbinit files for other targets can be found in tools/test_apps/system/gdb_loadable_elf/
  139. Recommended sdkconfig.defaults for building loadable ELF files is as follows.
  140. CONFIG_APP_BUILD_TYPE_ELF_RAM is required, other options help reduce application
  141. memory footprint.
  142. CONFIG_APP_BUILD_TYPE_ELF_RAM=y
  143. CONFIG_VFS_SUPPORT_TERMIOS=
  144. CONFIG_NEWLIB_NANO_FORMAT=y
  145. CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y
  146. CONFIG_ESP_DEBUG_STUBS_ENABLE=
  147. CONFIG_ESP_ERR_TO_NAME_LOOKUP=
  148. config APP_BUILD_TYPE_APP_2NDBOOT
  149. bool
  150. prompt "Default (binary application + 2nd stage bootloader)"
  151. select APP_BUILD_GENERATE_BINARIES
  152. select APP_BUILD_BOOTLOADER
  153. select APP_BUILD_USE_FLASH_SECTIONS
  154. config APP_BUILD_TYPE_ELF_RAM
  155. bool
  156. prompt "ELF file, loadable into RAM (EXPERIMENTAL))"
  157. endchoice # APP_BUILD_TYPE
  158. # Hidden options, set according to the choice above
  159. config APP_BUILD_GENERATE_BINARIES
  160. bool # Whether to generate .bin files or not
  161. config APP_BUILD_BOOTLOADER
  162. bool # Whether to build the bootloader
  163. config APP_BUILD_USE_FLASH_SECTIONS
  164. bool # Whether to place code/data into memory-mapped flash sections
  165. endmenu # Build type
  166. source "$COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE"
  167. menu "Compiler options"
  168. choice COMPILER_OPTIMIZATION
  169. prompt "Optimization Level"
  170. default COMPILER_OPTIMIZATION_DEFAULT
  171. help
  172. This option sets compiler optimization level (gcc -O argument) for the app.
  173. - The "Default" setting will add the -0g flag to CFLAGS.
  174. - The "Size" setting will add the -0s flag to CFLAGS.
  175. - The "Performance" setting will add the -O2 flag to CFLAGS.
  176. - The "None" setting will add the -O0 flag to CFLAGS.
  177. The "Size" setting cause the compiled code to be smaller and faster, but
  178. may lead to difficulties of correlating code addresses to source file
  179. lines when debugging.
  180. The "Performance" setting causes the compiled code to be larger and faster,
  181. but will be easier to correlated code addresses to source file lines.
  182. "None" with -O0 produces compiled code without optimization.
  183. Note that custom optimization levels may be unsupported.
  184. Compiler optimization for the IDF bootloader is set separately,
  185. see the BOOTLOADER_COMPILER_OPTIMIZATION setting.
  186. config COMPILER_OPTIMIZATION_DEFAULT
  187. bool "Debug (-Og)"
  188. config COMPILER_OPTIMIZATION_SIZE
  189. bool "Optimize for size (-Os)"
  190. config COMPILER_OPTIMIZATION_PERF
  191. bool "Optimize for performance (-O2)"
  192. config COMPILER_OPTIMIZATION_NONE
  193. bool "Debug without optimization (-O0)"
  194. endchoice
  195. choice COMPILER_OPTIMIZATION_ASSERTION_LEVEL
  196. prompt "Assertion level"
  197. default COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
  198. help
  199. Assertions can be:
  200. - Enabled. Failure will print verbose assertion details. This is the default.
  201. - Set to "silent" to save code size (failed assertions will abort() but user
  202. needs to use the aborting address to find the line number with the failed assertion.)
  203. - Disabled entirely (not recommended for most configurations.) -DNDEBUG is added
  204. to CPPFLAGS in this case.
  205. config COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
  206. prompt "Enabled"
  207. bool
  208. help
  209. Enable assertions. Assertion content and line number will be printed on failure.
  210. config COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
  211. prompt "Silent (saves code size)"
  212. bool
  213. help
  214. Enable silent assertions. Failed assertions will abort(), user needs to
  215. use the aborting address to find the line number with the failed assertion.
  216. config COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
  217. prompt "Disabled (sets -DNDEBUG)"
  218. bool
  219. help
  220. If assertions are disabled, -DNDEBUG is added to CPPFLAGS.
  221. endchoice # assertions
  222. config COMPILER_OPTIMIZATION_ASSERTION_LEVEL
  223. int
  224. default 0 if COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
  225. default 1 if COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
  226. default 2 if COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
  227. config COMPILER_OPTIMIZATION_CHECKS_SILENT
  228. bool "Disable messages in ESP_RETURN_ON_* and ESP_EXIT_ON_* macros"
  229. default n
  230. help
  231. If enabled, the error messages will be discarded in following check macros:
  232. - ESP_RETURN_ON_ERROR
  233. - ESP_EXIT_ON_ERROR
  234. - ESP_RETURN_ON_FALSE
  235. - ESP_EXIT_ON_FALSE
  236. menuconfig COMPILER_HIDE_PATHS_MACROS
  237. bool "Replace ESP-IDF and project paths in binaries"
  238. default y
  239. depends on IDF_CMAKE
  240. help
  241. When expanding the __FILE__ and __BASE_FILE__ macros, replace paths inside ESP-IDF
  242. with paths relative to the placeholder string "IDF", and convert paths inside the
  243. project directory to relative paths.
  244. This allows building the project with assertions or other code that embeds file paths,
  245. without the binary containing the exact path to the IDF or project directories.
  246. This option passes -fmacro-prefix-map options to the GCC command line. To replace additional
  247. paths in your binaries, modify the project CMakeLists.txt file to pass custom -fmacro-prefix-map or
  248. -ffile-prefix-map arguments.
  249. menuconfig COMPILER_CXX_EXCEPTIONS
  250. bool "Enable C++ exceptions"
  251. default n
  252. help
  253. Enabling this option compiles all IDF C++ files with exception support enabled.
  254. Disabling this option disables C++ exception support in all compiled files, and any libstdc++ code
  255. which throws an exception will abort instead.
  256. Enabling this option currently adds an additional ~500 bytes of heap overhead
  257. when an exception is thrown in user code for the first time.
  258. config COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE
  259. int "Emergency Pool Size"
  260. default 0
  261. depends on COMPILER_CXX_EXCEPTIONS
  262. help
  263. Size (in bytes) of the emergency memory pool for C++ exceptions. This pool will be used to allocate
  264. memory for thrown exceptions when there is not enough memory on the heap.
  265. config COMPILER_CXX_RTTI
  266. bool "Enable C++ run-time type info (RTTI)"
  267. default n
  268. help
  269. Enabling this option compiles all C++ files with RTTI support enabled.
  270. This increases binary size (typically by tens of kB) but allows using
  271. dynamic_cast conversion and typeid operator.
  272. choice COMPILER_STACK_CHECK_MODE
  273. prompt "Stack smashing protection mode"
  274. default COMPILER_STACK_CHECK_MODE_NONE
  275. help
  276. Stack smashing protection mode. Emit extra code to check for buffer overflows, such as stack
  277. smashing attacks. This is done by adding a guard variable to functions with vulnerable objects.
  278. The guards are initialized when a function is entered and then checked when the function exits.
  279. If a guard check fails, program is halted. Protection has the following modes:
  280. - In NORMAL mode (GCC flag: -fstack-protector) only functions that call alloca, and functions with
  281. buffers larger than 8 bytes are protected.
  282. - STRONG mode (GCC flag: -fstack-protector-strong) is like NORMAL, but includes additional functions
  283. to be protected -- those that have local array definitions, or have references to local frame
  284. addresses.
  285. - In OVERALL mode (GCC flag: -fstack-protector-all) all functions are protected.
  286. Modes have the following impact on code performance and coverage:
  287. - performance: NORMAL > STRONG > OVERALL
  288. - coverage: NORMAL < STRONG < OVERALL
  289. The performance impact includes increasing the amount of stack memory required for each task.
  290. config COMPILER_STACK_CHECK_MODE_NONE
  291. bool "None"
  292. config COMPILER_STACK_CHECK_MODE_NORM
  293. bool "Normal"
  294. config COMPILER_STACK_CHECK_MODE_STRONG
  295. bool "Strong"
  296. config COMPILER_STACK_CHECK_MODE_ALL
  297. bool "Overall"
  298. endchoice
  299. config COMPILER_STACK_CHECK
  300. bool
  301. default !COMPILER_STACK_CHECK_MODE_NONE
  302. help
  303. Stack smashing protection.
  304. config COMPILER_WARN_WRITE_STRINGS
  305. bool "Enable -Wwrite-strings warning flag"
  306. default "n"
  307. help
  308. Adds -Wwrite-strings flag for the C/C++ compilers.
  309. For C, this gives string constants the type ``const char[]`` so that
  310. copying the address of one into a non-const ``char *`` pointer
  311. produces a warning. This warning helps to find at compile time code
  312. that tries to write into a string constant.
  313. For C++, this warns about the deprecated conversion from string
  314. literals to ``char *``.
  315. config COMPILER_SAVE_RESTORE_LIBCALLS
  316. bool "Enable -msave-restore flag to reduce code size"
  317. depends on IDF_TARGET_ARCH_RISCV
  318. help
  319. Adds -msave-restore to C/C++ compilation flags.
  320. When this flag is enabled, compiler will call library functions to
  321. save/restore registers in function prologues/epilogues. This results
  322. in lower overall code size, at the expense of slightly reduced performance.
  323. This option can be enabled for RISC-V targets only.
  324. config COMPILER_DISABLE_GCC8_WARNINGS
  325. bool "Disable new warnings introduced in GCC 6 - 8"
  326. default "n"
  327. help
  328. Enable this option if using GCC 6 or newer, and wanting to disable warnings which don't appear with
  329. GCC 5.
  330. config COMPILER_DUMP_RTL_FILES
  331. bool "Dump RTL files during compilation"
  332. help
  333. If enabled, RTL files will be produced during compilation. These files
  334. can be used by other tools, for example to calculate call graphs.
  335. endmenu # Compiler Options
  336. menu "Component config"
  337. source "$COMPONENT_KCONFIGS_SOURCE_FILE"
  338. endmenu
  339. menu "Compatibility options"
  340. config LEGACY_INCLUDE_COMMON_HEADERS
  341. bool "Include headers across components as before IDF v4.0"
  342. default n
  343. help
  344. Soc, esp32, and driver components, the most common
  345. components. Some header of these components are included
  346. implicitly by headers of other components before IDF v4.0.
  347. It's not required for high-level components, but still
  348. included through long header chain everywhere.
  349. This is harmful to the modularity. So it's changed in IDF
  350. v4.0.
  351. You can still include these headers in a legacy way until it
  352. is totally deprecated by enable this option.
  353. endmenu #Compatibility options