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