]> granicus.if.org Git - esp-idf/blob - Kconfig.compiler
Merge branch 'bugfix/btdm_lmp_trans_coll_state_uncleared' into 'master'
[esp-idf] / Kconfig.compiler
1 menu "Compiler options"
2
3 choice OPTIMIZATION_COMPILER
4     prompt "Optimization Level"
5     default OPTIMIZATION_LEVEL_DEBUG
6     help
7         This option sets compiler optimization level (gcc -O argument).
8
9         - for "Release" setting, -Os flag is added to CFLAGS.
10         - for "Debug" setting, -Og flag is added to CFLAGS.
11
12         "Release" with -Os produces smaller & faster compiled code but it
13         may be harder to correlated code addresses to source files when debugging.
14
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.
18
19 config OPTIMIZATION_LEVEL_DEBUG
20     bool "Debug (-Og)"
21 config OPTIMIZATION_LEVEL_RELEASE
22     bool "Release (-Os)"
23 endchoice
24
25 choice OPTIMIZATION_ASSERTION_LEVEL
26     prompt "Assertion level"
27     default OPTIMIZATION_ASSERTIONS_ENABLED
28     help
29         Assertions can be:
30
31         - Enabled. Failure will print verbose assertion details. This is the default.
32
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.)
35
36         - Disabled entirely (not recommended for most configurations.) -DNDEBUG is added
37           to CPPFLAGS in this case.
38
39 config OPTIMIZATION_ASSERTIONS_ENABLED
40     prompt "Enabled"
41     bool
42     help
43         Enable assertions. Assertion content and line number will be printed on failure.
44
45 config OPTIMIZATION_ASSERTIONS_SILENT
46     prompt "Silent (saves code size)"
47     bool
48     help
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.
51
52 config OPTIMIZATION_ASSERTIONS_DISABLED
53     prompt "Disabled (sets -DNDEBUG)"
54     bool
55     help
56         If assertions are disabled, -DNDEBUG is added to CPPFLAGS.
57
58 endchoice # assertions
59
60 menuconfig CXX_EXCEPTIONS
61    bool "Enable C++ exceptions"
62    default n
63    help
64        Enabling this option compiles all IDF C++ files with exception support enabled.
65
66        Disabling this option disables C++ exception support in all compiled files, and any libstdc++ code which throws
67        an exception will abort instead.
68
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.
71
72 config CXX_EXCEPTIONS_EMG_POOL_SIZE
73     int "Emergency Pool Size"
74     default 0
75     depends on CXX_EXCEPTIONS
76     help
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.
79
80 choice STACK_CHECK_MODE
81     prompt "Stack smashing protection mode"
82     default STACK_CHECK_NONE
83     help
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:
88
89         - In NORMAL mode (GCC flag: -fstack-protector) only functions that call alloca,
90           and functions with buffers larger than 8 bytes are protected.
91         
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.
95         
96         - In OVERALL mode (GCC flag: -fstack-protector-all) all functions are protected.
97
98         Modes have the following impact on code performance and coverage:
99
100         - performance: NORMAL > STRONG > OVERALL
101         
102         - coverage: NORMAL < STRONG < OVERALL
103
104
105 config STACK_CHECK_NONE
106     bool "None"
107 config STACK_CHECK_NORM
108     bool "Normal"
109 config STACK_CHECK_STRONG
110     bool "Strong"
111 config STACK_CHECK_ALL
112     bool "Overall"
113 endchoice
114
115 config STACK_CHECK
116     bool
117     default !STACK_CHECK_NONE
118     help
119         Stack smashing protection.
120
121 config WARN_WRITE_STRINGS
122     bool "Enable -Wwrite-strings warning flag"
123     default "n"
124     help
125         Adds -Wwrite-strings flag for the C/C++ compilers.
126
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.
131
132         For C++, this warns about the deprecated conversion from string
133         literals to ``char *``.
134
135 endmenu # Compiler Options