2 # For a description of the syntax of this configuration file,
3 # see kconfig/kconfig-language.txt.
5 mainmenu "Espressif IoT Development Framework Configuration"
7 # Hidden option to support checking for this specific target in C code and Kconfig files
8 config IDF_TARGET_ESP32
10 default "y" if IDF_TARGET="esp32"
15 option env="IDF_CMAKE"
19 # A proxy to get environment variable $IDF_TARGET
21 option env="IDF_TARGET"
24 # This option records the IDF target when sdkconfig is generated the first time.
25 # It is not updated if environment variable $IDF_TARGET changes later, and
26 # the build system is responsible for detecting the mismatch between
27 # CONFIG_IDF_TARGET and $IDF_TARGET.
29 default "IDF_TARGET_NOT_SET" if IDF_TARGET_ENV=""
30 default IDF_TARGET_ENV
32 config IDF_FIRMWARE_CHIP_ID
34 default 0x0000 if IDF_TARGET="esp32"
37 menu "SDK tool configuration"
39 string "Compiler toolchain path/prefix"
40 default "xtensa-esp32-elf-"
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.
46 string "Python 2 interpreter"
50 The executable name/path that is used to run python. On some systems Python 2.x
51 may need to be invoked as python2.
53 (Note: This option is used with the legacy GNU Make build system only.)
55 config SDK_MAKE_WARN_UNDEFINED_VARIABLES
56 bool "'make' warns on undefined variables"
60 Adds --warn-undefined-variables to MAKEFLAGS. This causes make to
61 print a warning any time an undefined variable is referenced.
63 This option helps find places where a variable reference is misspelled
64 or otherwise missing, but it can be unwanted if you have Makefiles which
65 depend on undefined variables expanding to an empty string.
67 (Note: this option is used with the legacy GNU Make build system only.)
69 endmenu # SDK tool configuration
74 prompt "Application build type"
75 default APP_BUILD_TYPE_APP_2NDBOOT
77 Select the way the application is built.
79 By default, the application is built as a binary file in a format compatible with
80 the ESP32 bootloader. In addition to this application, 2nd stage bootloader is
81 also built. Application and bootloader binaries can be written into flash and
82 loaded/executed from there.
84 Another option, useful for only very small and limited applications, is to only link
85 the .elf file of the application, such that it can be loaded directly into RAM over
86 JTAG. Note that since IRAM and DRAM sizes are very limited, it is not possible to
87 build any complex application this way. However for kinds of testing and debugging,
88 this option may provide faster iterations, since the application does not need to be
90 Note that at the moment, ESP-IDF does not contain all the startup code required to
91 initialize the CPUs and ROM memory (data/bss). Therefore it is necessary to execute
92 a bit of ROM code prior to executing the application. A gdbinit file may look as follows:
94 # Connect to a running instance of OpenOCD
96 # Reset and halt the target
98 # Run to a specific point in ROM code,
99 # where most of initialization is complete.
102 # Load the application into RAM
108 Execute this gdbinit file as follows:
110 xtensa-esp32-elf-gdb build/app-name.elf -x gdbinit
112 Recommended sdkconfig.defaults for building loadable ELF files is as follows.
113 CONFIG_APP_BUILD_TYPE_ELF_RAM is required, other options help reduce application
116 CONFIG_APP_BUILD_TYPE_ELF_RAM=y
117 CONFIG_VFS_SUPPORT_TERMIOS=
118 CONFIG_NEWLIB_NANO_FORMAT=y
119 CONFIG_ESP32_PANIC_PRINT_HALT=y
120 CONFIG_ESP32_DEBUG_STUBS_ENABLE=
121 CONFIG_ESP_ERR_TO_NAME_LOOKUP=
124 config APP_BUILD_TYPE_APP_2NDBOOT
126 prompt "Default (binary application + 2nd stage bootloader)"
127 select APP_BUILD_GENERATE_BINARIES
128 select APP_BUILD_BOOTLOADER
129 select APP_BUILD_USE_FLASH_SECTIONS
131 config APP_BUILD_TYPE_ELF_RAM
133 prompt "ELF file, loadable into RAM (EXPERIMENTAL))"
134 endchoice # APP_BUILD_TYPE
136 # Hidden options, set according to the choice above
137 config APP_BUILD_GENERATE_BINARIES
138 bool # Whether to generate .bin files or not
140 config APP_BUILD_BOOTLOADER
141 bool # Whether to build the bootloader
143 config APP_BUILD_USE_FLASH_SECTIONS
144 bool # Whether to place code/data into memory-mapped flash sections
148 source "$COMPONENT_KCONFIGS_PROJBUILD"
150 menu "Compiler options"
152 choice COMPILER_OPTIMIZATION
153 prompt "Optimization Level"
154 default COMPILER_OPTIMIZATION_DEFAULT
156 This option sets compiler optimization level (gcc -O argument).
158 - The "Default" setting will add the -0g flag to CFLAGS.
159 - The "Size" setting will add the -0s flag to CFLAGS.
160 - The "Performance" setting will add the -O2 flag to CFLAGS.
161 - The "None" setting will add the -O0 flag to CFLAGS.
163 The "Size" setting cause the compiled code to be smaller and faster, but
164 may lead to difficulties of correlating code addresses to source file
165 lines when debugging.
167 The "Performance" setting causes the compiled code to be larger and faster,
168 but will be easier to correlated code addresses to source file lines.
170 "None" with -O0 produces compiled code without optimization.
172 Note that custom optimization levels may be unsupported.
174 config COMPILER_OPTIMIZATION_DEFAULT
176 config COMPILER_OPTIMIZATION_SIZE
177 bool "Optimize for size (-Os)"
178 config COMPILER_OPTIMIZATION_PERF
179 bool "Optimize for performance (-O2)"
180 config COMPILER_OPTIMIZATION_NONE
181 bool "Debug without optimization (-O0)"
185 choice COMPILER_OPTIMIZATION_ASSERTION_LEVEL
186 prompt "Assertion level"
187 default COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
191 - Enabled. Failure will print verbose assertion details. This is the default.
193 - Set to "silent" to save code size (failed assertions will abort() but user
194 needs to use the aborting address to find the line number with the failed assertion.)
196 - Disabled entirely (not recommended for most configurations.) -DNDEBUG is added
197 to CPPFLAGS in this case.
199 config COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
203 Enable assertions. Assertion content and line number will be printed on failure.
205 config COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
206 prompt "Silent (saves code size)"
209 Enable silent assertions. Failed assertions will abort(), user needs to
210 use the aborting address to find the line number with the failed assertion.
212 config COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
213 prompt "Disabled (sets -DNDEBUG)"
216 If assertions are disabled, -DNDEBUG is added to CPPFLAGS.
218 endchoice # assertions
220 menuconfig COMPILER_CXX_EXCEPTIONS
221 bool "Enable C++ exceptions"
224 Enabling this option compiles all IDF C++ files with exception support enabled.
226 Disabling this option disables C++ exception support in all compiled files, and any libstdc++ code
227 which throws an exception will abort instead.
229 Enabling this option currently adds an additional ~500 bytes of heap overhead
230 when an exception is thrown in user code for the first time.
232 config COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE
233 int "Emergency Pool Size"
235 depends on COMPILER_CXX_EXCEPTIONS
237 Size (in bytes) of the emergency memory pool for C++ exceptions. This pool will be used to allocate
238 memory for thrown exceptions when there is not enough memory on the heap.
240 config COMPILER_CXX_RTTI
241 # Invisible option, until the toolchain with RTTI support is released.
242 # Use prompt "Enable C++ run-time type info (RTTI)" when updating.
245 Enabling this option compiles all C++ files with RTTI support enabled.
246 This increases binary size (typically by tens of kB) but allows using
247 dynamic_cast conversion and typeid operator.
249 choice COMPILER_STACK_CHECK_MODE
250 prompt "Stack smashing protection mode"
251 default COMPILER_STACK_CHECK_MODE_NONE
253 Stack smashing protection mode. Emit extra code to check for buffer overflows, such as stack
254 smashing attacks. This is done by adding a guard variable to functions with vulnerable objects.
255 The guards are initialized when a function is entered and then checked when the function exits.
256 If a guard check fails, program is halted. Protection has the following modes:
258 - In NORMAL mode (GCC flag: -fstack-protector) only functions that call alloca, and functions with
259 buffers larger than 8 bytes are protected.
261 - STRONG mode (GCC flag: -fstack-protector-strong) is like NORMAL, but includes additional functions
262 to be protected -- those that have local array definitions, or have references to local frame
265 - In OVERALL mode (GCC flag: -fstack-protector-all) all functions are protected.
267 Modes have the following impact on code performance and coverage:
269 - performance: NORMAL > STRONG > OVERALL
271 - coverage: NORMAL < STRONG < OVERALL
274 config COMPILER_STACK_CHECK_MODE_NONE
276 config COMPILER_STACK_CHECK_MODE_NORM
278 config COMPILER_STACK_CHECK_MODE_STRONG
280 config COMPILER_STACK_CHECK_MODE_ALL
284 config COMPILER_STACK_CHECK
286 default !COMPILER_STACK_CHECK_MODE_NONE
288 Stack smashing protection.
290 config COMPILER_WARN_WRITE_STRINGS
291 bool "Enable -Wwrite-strings warning flag"
294 Adds -Wwrite-strings flag for the C/C++ compilers.
296 For C, this gives string constants the type ``const char[]`` so that
297 copying the address of one into a non-const ``char *`` pointer
298 produces a warning. This warning helps to find at compile time code
299 that tries to write into a string constant.
301 For C++, this warns about the deprecated conversion from string
302 literals to ``char *``.
304 config COMPILER_DISABLE_GCC8_WARNINGS
305 bool "Disable new warnings introduced in GCC 6 - 8"
308 Enable this option if using GCC 6 or newer, and wanting to disable warnings which don't appear with
312 endmenu # Compiler Options
314 menu "Component config"
315 source "$COMPONENT_KCONFIGS"
318 menu "Compatibility options"
319 config LEGACY_INCLUDE_COMMON_HEADERS
320 bool "Include headers accross components as before IDF v4.0"
323 Soc, esp32, and driver components, the most common
324 components. Some header of these components are included
325 implicitly by headers of other components before IDF v4.0.
326 It's not required for high-level components, but still
327 included through long header chain everywhere.
329 This is harmful to the modularity. So it's changed in IDF
332 You can still include these headers in a legacy way until it
333 is totally deprecated by enable this option.
335 endmenu #Compatibility options