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