Kconfig 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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. # Hidden option to support checking for this specific target in C code and Kconfig files
  7. config IDF_TARGET_ESP32
  8. bool
  9. default "y" if IDF_TARGET="esp32"
  10. default "n"
  11. config IDF_CMAKE
  12. bool
  13. option env="IDF_CMAKE"
  14. config IDF_TARGET
  15. # This option records the IDF target when sdkconfig is generated the first time.
  16. # It is not updated if environment variable $IDF_TARGET changes later, and
  17. # the build system is responsible for detecting the mismatch between
  18. # CONFIG_IDF_TARGET and $IDF_TARGET.
  19. string
  20. default "$(IDF_TARGET)"
  21. config IDF_TARGET_ESP32
  22. bool
  23. default "y" if IDF_TARGET="esp32"
  24. default "n"
  25. config IDF_TARGET_ESP32S2BETA
  26. bool
  27. default "y" if IDF_TARGET="esp32s2beta"
  28. default "n"
  29. select FREERTOS_UNICORE
  30. config IDF_FIRMWARE_CHIP_ID
  31. hex
  32. default 0x0000 if IDF_TARGET_ESP32
  33. # note: S2 beta uses Chip ID 0 still, S2 will use 0x0002
  34. default 0x0000 if IDF_TARGET_ESP32S2BETA
  35. default 0xFFFF
  36. menu "SDK tool configuration"
  37. config SDK_TOOLPREFIX
  38. string "Compiler toolchain path/prefix"
  39. default "xtensa-esp32-elf-" if IDF_TARGET_ESP32
  40. default "xtensa-esp32s2-elf-" if IDF_TARGET_ESP32S2BETA
  41. help
  42. The prefix/path that is used to call the toolchain. The default setting assumes
  43. a crosstool-ng gcc setup that is in your PATH.
  44. config SDK_PYTHON
  45. string "Python 2 interpreter"
  46. depends on !IDF_CMAKE
  47. default "python"
  48. help
  49. The executable name/path that is used to run python. On some systems Python 2.x
  50. may need to be invoked as python2.
  51. (Note: This option is used with the legacy GNU Make build system only.)
  52. config SDK_MAKE_WARN_UNDEFINED_VARIABLES
  53. bool "'make' warns on undefined variables"
  54. depends on !IDF_CMAKE
  55. default "y"
  56. help
  57. Adds --warn-undefined-variables to MAKEFLAGS. This causes make to
  58. print a warning any time an undefined variable is referenced.
  59. This option helps find places where a variable reference is misspelled
  60. or otherwise missing, but it can be unwanted if you have Makefiles which
  61. depend on undefined variables expanding to an empty string.
  62. (Note: this option is used with the legacy GNU Make build system only.)
  63. endmenu # SDK tool configuration
  64. menu "Build type"
  65. choice APP_BUILD_TYPE
  66. prompt "Application build type"
  67. default APP_BUILD_TYPE_APP_2NDBOOT
  68. help
  69. Select the way the application is built.
  70. By default, the application is built as a binary file in a format compatible with
  71. the ESP32 bootloader. In addition to this application, 2nd stage bootloader is
  72. also built. Application and bootloader binaries can be written into flash and
  73. loaded/executed from there.
  74. Another option, useful for only very small and limited applications, is to only link
  75. the .elf file of the application, such that it can be loaded directly into RAM over
  76. JTAG. Note that since IRAM and DRAM sizes are very limited, it is not possible to
  77. build any complex application this way. However for kinds of testing and debugging,
  78. this option may provide faster iterations, since the application does not need to be
  79. written into flash.
  80. Note that at the moment, ESP-IDF does not contain all the startup code required to
  81. initialize the CPUs and ROM memory (data/bss). Therefore it is necessary to execute
  82. a bit of ROM code prior to executing the application. A gdbinit file may look as follows:
  83. # Connect to a running instance of OpenOCD
  84. target remote :3333
  85. # Reset and halt the target
  86. mon reset halt
  87. # Run to a specific point in ROM code,
  88. # where most of initialization is complete.
  89. thb *0x40007901
  90. c
  91. # Load the application into RAM
  92. load
  93. # Run till app_main
  94. tb app_main
  95. c
  96. Execute this gdbinit file as follows:
  97. xtensa-esp32-elf-gdb build/app-name.elf -x gdbinit
  98. Recommended sdkconfig.defaults for building loadable ELF files is as follows.
  99. CONFIG_APP_BUILD_TYPE_ELF_RAM is required, other options help reduce application
  100. memory footprint.
  101. CONFIG_APP_BUILD_TYPE_ELF_RAM=y
  102. CONFIG_VFS_SUPPORT_TERMIOS=
  103. CONFIG_NEWLIB_NANO_FORMAT=y
  104. CONFIG_ESP32_PANIC_PRINT_HALT=y
  105. CONFIG_ESP32_DEBUG_STUBS_ENABLE=
  106. CONFIG_ESP_ERR_TO_NAME_LOOKUP=
  107. config APP_BUILD_TYPE_APP_2NDBOOT
  108. bool
  109. prompt "Default (binary application + 2nd stage bootloader)"
  110. select APP_BUILD_GENERATE_BINARIES
  111. select APP_BUILD_BOOTLOADER
  112. select APP_BUILD_USE_FLASH_SECTIONS
  113. config APP_BUILD_TYPE_ELF_RAM
  114. bool
  115. prompt "ELF file, loadable into RAM (EXPERIMENTAL))"
  116. endchoice # APP_BUILD_TYPE
  117. # Hidden options, set according to the choice above
  118. config APP_BUILD_GENERATE_BINARIES
  119. bool # Whether to generate .bin files or not
  120. config APP_BUILD_BOOTLOADER
  121. bool # Whether to build the bootloader
  122. config APP_BUILD_USE_FLASH_SECTIONS
  123. bool # Whether to place code/data into memory-mapped flash sections
  124. endmenu # Build type
  125. source "$COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE"
  126. menu "Compiler options"
  127. choice COMPILER_OPTIMIZATION
  128. prompt "Optimization Level"
  129. default COMPILER_OPTIMIZATION_DEFAULT
  130. help
  131. This option sets compiler optimization level (gcc -O argument).
  132. - The "Default" setting will add the -0g flag to CFLAGS.
  133. - The "Size" setting will add the -0s flag to CFLAGS.
  134. - The "Performance" setting will add the -O2 flag to CFLAGS.
  135. - The "None" setting will add the -O0 flag to CFLAGS.
  136. The "Size" setting cause the compiled code to be smaller and faster, but
  137. may lead to difficulties of correlating code addresses to source file
  138. lines when debugging.
  139. The "Performance" setting causes the compiled code to be larger and faster,
  140. but will be easier to correlated code addresses to source file lines.
  141. "None" with -O0 produces compiled code without optimization.
  142. Note that custom optimization levels may be unsupported.
  143. config COMPILER_OPTIMIZATION_DEFAULT
  144. bool "Debug (-Og)"
  145. config COMPILER_OPTIMIZATION_SIZE
  146. bool "Optimize for size (-Os)"
  147. config COMPILER_OPTIMIZATION_PERF
  148. bool "Optimize for performance (-O2)"
  149. config COMPILER_OPTIMIZATION_NONE
  150. bool "Debug without optimization (-O0)"
  151. endchoice
  152. choice COMPILER_OPTIMIZATION_ASSERTION_LEVEL
  153. prompt "Assertion level"
  154. default COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
  155. help
  156. Assertions can be:
  157. - Enabled. Failure will print verbose assertion details. This is the default.
  158. - Set to "silent" to save code size (failed assertions will abort() but user
  159. needs to use the aborting address to find the line number with the failed assertion.)
  160. - Disabled entirely (not recommended for most configurations.) -DNDEBUG is added
  161. to CPPFLAGS in this case.
  162. config COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
  163. prompt "Enabled"
  164. bool
  165. help
  166. Enable assertions. Assertion content and line number will be printed on failure.
  167. config COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
  168. prompt "Silent (saves code size)"
  169. bool
  170. help
  171. Enable silent assertions. Failed assertions will abort(), user needs to
  172. use the aborting address to find the line number with the failed assertion.
  173. config COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
  174. prompt "Disabled (sets -DNDEBUG)"
  175. bool
  176. help
  177. If assertions are disabled, -DNDEBUG is added to CPPFLAGS.
  178. endchoice # assertions
  179. menuconfig COMPILER_CXX_EXCEPTIONS
  180. bool "Enable C++ exceptions"
  181. default n
  182. help
  183. Enabling this option compiles all IDF C++ files with exception support enabled.
  184. Disabling this option disables C++ exception support in all compiled files, and any libstdc++ code
  185. which throws an exception will abort instead.
  186. Enabling this option currently adds an additional ~500 bytes of heap overhead
  187. when an exception is thrown in user code for the first time.
  188. config COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE
  189. int "Emergency Pool Size"
  190. default 0
  191. depends on COMPILER_CXX_EXCEPTIONS
  192. help
  193. Size (in bytes) of the emergency memory pool for C++ exceptions. This pool will be used to allocate
  194. memory for thrown exceptions when there is not enough memory on the heap.
  195. config COMPILER_CXX_RTTI
  196. bool "Enable C++ run-time type info (RTTI)"
  197. default n
  198. help
  199. Enabling this option compiles all C++ files with RTTI support enabled.
  200. This increases binary size (typically by tens of kB) but allows using
  201. dynamic_cast conversion and typeid operator.
  202. choice COMPILER_STACK_CHECK_MODE
  203. prompt "Stack smashing protection mode"
  204. default COMPILER_STACK_CHECK_MODE_NONE
  205. help
  206. Stack smashing protection mode. Emit extra code to check for buffer overflows, such as stack
  207. smashing attacks. This is done by adding a guard variable to functions with vulnerable objects.
  208. The guards are initialized when a function is entered and then checked when the function exits.
  209. If a guard check fails, program is halted. Protection has the following modes:
  210. - In NORMAL mode (GCC flag: -fstack-protector) only functions that call alloca, and functions with
  211. buffers larger than 8 bytes are protected.
  212. - STRONG mode (GCC flag: -fstack-protector-strong) is like NORMAL, but includes additional functions
  213. to be protected -- those that have local array definitions, or have references to local frame
  214. addresses.
  215. - In OVERALL mode (GCC flag: -fstack-protector-all) all functions are protected.
  216. Modes have the following impact on code performance and coverage:
  217. - performance: NORMAL > STRONG > OVERALL
  218. - coverage: NORMAL < STRONG < OVERALL
  219. config COMPILER_STACK_CHECK_MODE_NONE
  220. bool "None"
  221. config COMPILER_STACK_CHECK_MODE_NORM
  222. bool "Normal"
  223. config COMPILER_STACK_CHECK_MODE_STRONG
  224. bool "Strong"
  225. config COMPILER_STACK_CHECK_MODE_ALL
  226. bool "Overall"
  227. endchoice
  228. config COMPILER_STACK_CHECK
  229. bool
  230. default !COMPILER_STACK_CHECK_MODE_NONE
  231. help
  232. Stack smashing protection.
  233. config COMPILER_WARN_WRITE_STRINGS
  234. bool "Enable -Wwrite-strings warning flag"
  235. default "n"
  236. help
  237. Adds -Wwrite-strings flag for the C/C++ compilers.
  238. For C, this gives string constants the type ``const char[]`` so that
  239. copying the address of one into a non-const ``char *`` pointer
  240. produces a warning. This warning helps to find at compile time code
  241. that tries to write into a string constant.
  242. For C++, this warns about the deprecated conversion from string
  243. literals to ``char *``.
  244. config COMPILER_DISABLE_GCC8_WARNINGS
  245. bool "Disable new warnings introduced in GCC 6 - 8"
  246. default "n"
  247. help
  248. Enable this option if using GCC 6 or newer, and wanting to disable warnings which don't appear with
  249. GCC 5.
  250. endmenu # Compiler Options
  251. menu "Component config"
  252. source "$COMPONENT_KCONFIGS_SOURCE_FILE"
  253. endmenu
  254. menu "Compatibility options"
  255. config LEGACY_INCLUDE_COMMON_HEADERS
  256. bool "Include headers accross components as before IDF v4.0"
  257. default n
  258. help
  259. Soc, esp32, and driver components, the most common
  260. components. Some header of these components are included
  261. implicitly by headers of other components before IDF v4.0.
  262. It's not required for high-level components, but still
  263. included through long header chain everywhere.
  264. This is harmful to the modularity. So it's changed in IDF
  265. v4.0.
  266. You can still include these headers in a legacy way until it
  267. is totally deprecated by enable this option.
  268. endmenu #Compatibility options