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