1 menu "Compiler options"
3 choice OPTIMIZATION_COMPILER
4 prompt "Optimization Level"
5 default OPTIMIZATION_LEVEL_DEBUG
7 This option sets compiler optimization level (gcc -O argument).
9 - for "Release" setting, -Os flag is added to CFLAGS.
10 - for "Debug" setting, -Og flag is added to CFLAGS.
12 "Release" with -Os produces smaller & faster compiled code but it
13 may be harder to correlated code addresses to source files when debugging.
15 To add custom optimization settings, set CFLAGS and/or CPPFLAGS
16 in project makefile, before including $(IDF_PATH)/make/project.mk. Note that
17 custom optimization levels may be unsupported.
19 config OPTIMIZATION_LEVEL_DEBUG
21 config OPTIMIZATION_LEVEL_RELEASE
25 choice OPTIMIZATION_ASSERTION_LEVEL
26 prompt "Assertion level"
27 default OPTIMIZATION_ASSERTIONS_ENABLED
31 - Enabled. Failure will print verbose assertion details. This is the default.
33 - Set to "silent" to save code size (failed assertions will abort() but user
34 needs to use the aborting address to find the line number with the failed assertion.)
36 - Disabled entirely (not recommended for most configurations.) -DNDEBUG is added
37 to CPPFLAGS in this case.
39 config OPTIMIZATION_ASSERTIONS_ENABLED
43 Enable assertions. Assertion content and line number will be printed on failure.
45 config OPTIMIZATION_ASSERTIONS_SILENT
46 prompt "Silent (saves code size)"
49 Enable silent assertions. Failed assertions will abort(), user needs to
50 use the aborting address to find the line number with the failed assertion.
52 config OPTIMIZATION_ASSERTIONS_DISABLED
53 prompt "Disabled (sets -DNDEBUG)"
56 If assertions are disabled, -DNDEBUG is added to CPPFLAGS.
58 endchoice # assertions
60 menuconfig CXX_EXCEPTIONS
61 bool "Enable C++ exceptions"
64 Enabling this option compiles all IDF C++ files with exception support enabled.
66 Disabling this option disables C++ exception support in all compiled files, and any libstdc++ code which throws
67 an exception will abort instead.
69 Enabling this option currently adds an additional ~500 bytes of heap overhead
70 when an exception is thrown in user code for the first time.
72 config CXX_EXCEPTIONS_EMG_POOL_SIZE
73 int "Emergency Pool Size"
75 depends on CXX_EXCEPTIONS
77 Size (in bytes) of the emergency memory pool for C++ exceptions. This pool will be used to allocate
78 memory for thrown exceptions when there is not enough memory on the heap.
80 choice STACK_CHECK_MODE
81 prompt "Stack smashing protection mode"
82 default STACK_CHECK_NONE
84 Stack smashing protection mode. Emit extra code to check for buffer overflows, such as stack
85 smashing attacks. This is done by adding a guard variable to functions with vulnerable objects.
86 The guards are initialized when a function is entered and then checked when the function exits.
87 If a guard check fails, program is halted. Protection has the following modes:
89 - In NORMAL mode (GCC flag: -fstack-protector) only functions that call alloca,
90 and functions with buffers larger than 8 bytes are protected.
92 - STRONG mode (GCC flag: -fstack-protector-strong) is like NORMAL, but includes
93 additional functions to be protected -- those that have local array definitions,
94 or have references to local frame addresses.
96 - In OVERALL mode (GCC flag: -fstack-protector-all) all functions are protected.
98 Modes have the following impact on code performance and coverage:
100 - performance: NORMAL > STRONG > OVERALL
102 - coverage: NORMAL < STRONG < OVERALL
105 config STACK_CHECK_NONE
107 config STACK_CHECK_NORM
109 config STACK_CHECK_STRONG
111 config STACK_CHECK_ALL
117 default !STACK_CHECK_NONE
119 Stack smashing protection.
121 config WARN_WRITE_STRINGS
122 bool "Enable -Wwrite-strings warning flag"
125 Adds -Wwrite-strings flag for the C/C++ compilers.
127 For C, this gives string constants the type ``const char[]`` so that
128 copying the address of one into a non-const ``char *`` pointer
129 produces a warning. This warning helps to find at compile time code
130 that tries to write into a string constant.
132 For C++, this warns about the deprecated conversion from string
133 literals to ``char *``.
135 endmenu # Compiler Options