Merge branch 'feature/update_global_kconfig' into 'master'

kconfig: update global "Kconfig" and its dependent compiling script

See merge request sdk/ESP8266_RTOS_SDK!1058
This commit is contained in:
Dong Heng
2019-08-16 11:26:58 +08:00
3 changed files with 209 additions and 174 deletions

124
Kconfig
View File

@ -4,38 +4,54 @@
# #
mainmenu "Espressif IoT Development Framework Configuration" mainmenu "Espressif IoT Development Framework Configuration"
choice IDF_TARGET # Hidden option to support checking for this specific target in C code and Kconfig files
bool "Espressif target platform choose"
default IDF_TARGET_ESP8266
help
Choose the specific target platform which you will use.
config IDF_TARGET_ESP8266 config IDF_TARGET_ESP8266
bool "esp8266" bool
endchoice default "y" if IDF_TARGET="esp8266"
default "n"
config IDF_CMAKE
bool
option env="IDF_CMAKE"
config IDF_TARGET_ENV
# A proxy to get environment variable $IDF_TARGET
string
option env="IDF_TARGET"
config IDF_TARGET config IDF_TARGET
# This option records the IDF target when sdkconfig is generated the first time.
# It is not updated if environment variable $IDF_TARGET changes later, and
# the build system is responsible for detecting the mismatch between
# CONFIG_IDF_TARGET and $IDF_TARGET.
string string
default "esp8266" if IDF_TARGET_ESP8266 default "IDF_TARGET_NOT_SET" if IDF_TARGET_ENV=""
default IDF_TARGET_ENV
menu "SDK tool configuration" menu "SDK tool configuration"
config SDK_TOOLPREFIX config SDK_TOOLPREFIX
string string "Compiler toolchain path/prefix"
default "xtensa-lx106-elf-" if IDF_TARGET_ESP8266 default "xtensa-lx106-elf-"
help help
The prefix/path that is used to call the toolchain. The default setting assumes The prefix/path that is used to call the toolchain. The default setting assumes
a crosstool-ng gcc setup that is in your PATH. a crosstool-ng gcc setup that is in your PATH.
config PYTHON config SDK_PYTHON
string "Python 2 interpreter" string "Python 2 interpreter"
depends on !IDF_CMAKE
default "python" default "python"
help help
The executable name/path that is used to run python. On some systems Python 2.x The executable name/path that is used to run python. On some systems Python 2.x
may need to be invoked as python2. may need to be invoked as python2.
config MAKE_WARN_UNDEFINED_VARIABLES (Note: This option is used with the legacy GNU Make build system only.)
config SDK_MAKE_WARN_UNDEFINED_VARIABLES
bool "'make' warns on undefined variables" bool "'make' warns on undefined variables"
default "y" depends on !IDF_CMAKE
default "n"
help help
Adds --warn-undefined-variables to MAKEFLAGS. This causes make to Adds --warn-undefined-variables to MAKEFLAGS. This causes make to
print a warning any time an undefined variable is referenced. print a warning any time an undefined variable is referenced.
@ -44,15 +60,17 @@ config MAKE_WARN_UNDEFINED_VARIABLES
or otherwise missing, but it can be unwanted if you have Makefiles which or otherwise missing, but it can be unwanted if you have Makefiles which
depend on undefined variables expanding to an empty string. depend on undefined variables expanding to an empty string.
(Note: this option is used with the legacy GNU Make build system only.)
endmenu # SDK tool configuration endmenu # SDK tool configuration
source "$COMPONENT_KCONFIGS_PROJBUILD" source "$COMPONENT_KCONFIGS_PROJBUILD"
menu "Compiler options" menu "Compiler options"
choice OPTIMIZATION_COMPILER choice COMPILER_OPTIMIZATION
prompt "Optimization Level" prompt "Optimization Level"
default OPTIMIZATION_LEVEL_DEBUG default COMPILER_OPTIMIZATION_LEVEL_DEBUG
help help
This option sets compiler optimization level (gcc -O argument). This option sets compiler optimization level (gcc -O argument).
@ -66,17 +84,18 @@ choice OPTIMIZATION_COMPILER
in project makefile, before including $(IDF_PATH)/make/project.mk. Note that in project makefile, before including $(IDF_PATH)/make/project.mk. Note that
custom optimization levels may be unsupported. custom optimization levels may be unsupported.
config OPTIMIZATION_LEVEL_DEBUG config COMPILER_OPTIMIZATION_LEVEL_DEBUG
bool "Debug (-Og)" bool "Debug (-Og)"
config OPTIMIZATION_LEVEL_RELEASE config COMPILER_OPTIMIZATION_LEVEL_RELEASE
bool "Release (-Os)" bool "Release (-Os)"
endchoice endchoice
choice OPTIMIZATION_ASSERTION_LEVEL choice COMPILER_OPTIMIZATION_ASSERTION_LEVEL
prompt "Assertion level" prompt "Assertion level"
default OPTIMIZATION_ASSERTIONS_ENABLED default COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
help help
Assertions can be: Assertions can be:
- Enabled. Failure will print verbose assertion details. This is the default. - Enabled. Failure will print verbose assertion details. This is the default.
- Set to "silent" to save code size (failed assertions will abort() but user - Set to "silent" to save code size (failed assertions will abort() but user
@ -85,20 +104,20 @@ choice OPTIMIZATION_ASSERTION_LEVEL
- Disabled entirely (not recommended for most configurations.) -DNDEBUG is added - Disabled entirely (not recommended for most configurations.) -DNDEBUG is added
to CPPFLAGS in this case. to CPPFLAGS in this case.
config OPTIMIZATION_ASSERTIONS_ENABLED config COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
prompt "Enabled" prompt "Enabled"
bool bool
help help
Enable assertions. Assertion content and line number will be printed on failure. Enable assertions. Assertion content and line number will be printed on failure.
config OPTIMIZATION_ASSERTIONS_SILENT config COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
prompt "Silent (saves code size)" prompt "Silent (saves code size)"
bool bool
help help
Enable silent assertions. Failed assertions will abort(), user needs to Enable silent assertions. Failed assertions will abort(), user needs to
use the aborting address to find the line number with the failed assertion. use the aborting address to find the line number with the failed assertion.
config OPTIMIZATION_ASSERTIONS_DISABLED config COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
prompt "Disabled (sets -DNDEBUG)" prompt "Disabled (sets -DNDEBUG)"
bool bool
help help
@ -106,61 +125,74 @@ config OPTIMIZATION_ASSERTIONS_DISABLED
endchoice # assertions endchoice # assertions
menuconfig CXX_EXCEPTIONS menuconfig COMPILER_CXX_EXCEPTIONS
bool "Enable C++ exceptions" bool "Enable C++ exceptions"
default n default n
help help
Enabling this option compiles all IDF C++ files with exception support enabled. Enabling this option compiles all IDF C++ files with exception support enabled.
Disabling this option disables C++ exception support in all compiled files, and any libstdc++ code which throws Disabling this option disables C++ exception support in all compiled files, and any libstdc++ code
an exception will abort instead. which throws an exception will abort instead.
Enabling this option currently adds an additional ~500 bytes of heap overhead Enabling this option currently adds an additional ~500 bytes of heap overhead
when an exception is thrown in user code for the first time. when an exception is thrown in user code for the first time.
config CXX_EXCEPTIONS_EMG_POOL_SIZE choice COMPILER_STACK_CHECK_MODE
int "Emergency Pool Size"
default 0
depends on CXX_EXCEPTIONS
help
Size (in bytes) of the emergency memory pool for C++ exceptions. This pool will be used to allocate
memory for thrown exceptions when there is not enough memory on the heap.
choice STACK_CHECK_MODE
prompt "Stack smashing protection mode" prompt "Stack smashing protection mode"
default STACK_CHECK_NONE default COMPILER_STACK_CHECK_MODE_NONE
help help
Stack smashing protection mode. Emit extra code to check for buffer overflows, such as stack Stack smashing protection mode. Emit extra code to check for buffer overflows, such as stack
smashing attacks. This is done by adding a guard variable to functions with vulnerable objects. smashing attacks. This is done by adding a guard variable to functions with vulnerable objects.
The guards are initialized when a function is entered and then checked when the function exits. The guards are initialized when a function is entered and then checked when the function exits.
If a guard check fails, program is halted. Protection has the following modes: If a guard check fails, program is halted. Protection has the following modes:
- In NORMAL mode (GCC flag: -fstack-protector) only functions that call alloca, and functions with buffers larger than
8 bytes are protected. - In NORMAL mode (GCC flag: -fstack-protector) only functions that call alloca, and functions with
- STRONG mode (GCC flag: -fstack-protector-strong) is like NORMAL, but includes additional functions to be protected -- those that buffers larger than 8 bytes are protected.
have local array definitions, or have references to local frame addresses.
- STRONG mode (GCC flag: -fstack-protector-strong) is like NORMAL, but includes additional functions
to be protected -- those that have local array definitions, or have references to local frame
addresses.
- In OVERALL mode (GCC flag: -fstack-protector-all) all functions are protected. - In OVERALL mode (GCC flag: -fstack-protector-all) all functions are protected.
Modes have the following impact on code performance and coverage: Modes have the following impact on code performance and coverage:
- performance: NORMAL > STRONG > OVERALL - performance: NORMAL > STRONG > OVERALL
- coverage: NORMAL < STRONG < OVERALL - coverage: NORMAL < STRONG < OVERALL
config STACK_CHECK_NONE config COMPILER_STACK_CHECK_MODE_NONE
bool "None" bool "None"
config STACK_CHECK_NORM config COMPILER_STACK_CHECK_MODE_NORM
bool "Normal" bool "Normal"
config STACK_CHECK_STRONG config COMPILER_STACK_CHECK_MODE_STRONG
bool "Strong" bool "Strong"
config STACK_CHECK_ALL config COMPILER_STACK_CHECK_MODE_ALL
bool "Overall" bool "Overall"
endchoice endchoice
config STACK_CHECK config COMPILER_STACK_CHECK
bool bool
default !STACK_CHECK_NONE default !COMPILER_STACK_CHECK_MODE_NONE
help help
Stack smashing protection. Stack smashing protection.
config COMPILER_WARN_WRITE_STRINGS
bool "Enable -Wwrite-strings warning flag"
default "n"
help
Adds -Wwrite-strings flag for the C/C++ compilers.
For C, this gives string constants the type ``const char[]`` so that
copying the address of one into a non-const ``char *`` pointer
produces a warning. This warning helps to find at compile time code
that tries to write into a string constant.
For C++, this warns about the deprecated conversion from string
literals to ``char *``.
endmenu # Compiler Options endmenu # Compiler Options
menu "Component config" menu "Component config"

View File

@ -95,11 +95,11 @@ $(error IDF_PATH variable is not set to a valid directory.)
endif endif
ifdef IDF_TARGET ifdef IDF_TARGET
ifneq ($(IDF_TARGET),esp32) ifneq ($(IDF_TARGET),esp8266)
$(error GNU Make based build system only supports esp32 target, but IDF_TARGET is set to $(IDF_TARGET)) $(error GNU Make based build system only supports esp8266 target, but IDF_TARGET is set to $(IDF_TARGET))
endif endif
else else
export IDF_TARGET := esp32 export IDF_TARGET := esp8266
endif endif
@ -377,21 +377,6 @@ COMMON_WARNING_FLAGS = -Wall -Werror=all \
-Wextra \ -Wextra \
-Wno-unused-parameter -Wno-sign-compare -Wno-unused-parameter -Wno-sign-compare
ifdef CONFIG_COMPILER_DISABLE_GCC8_WARNINGS
COMMON_WARNING_FLAGS += -Wno-parentheses \
-Wno-sizeof-pointer-memaccess \
-Wno-clobbered \
-Wno-format-overflow \
-Wno-stringop-truncation \
-Wno-misleading-indentation \
-Wno-cast-function-type \
-Wno-implicit-fallthrough \
-Wno-unused-const-variable \
-Wno-switch-unreachable \
-Wno-format-truncation \
-Wno-memset-elt-size \
-Wno-int-in-bool-context
endif
ifdef CONFIG_COMPILER_WARN_WRITE_STRINGS ifdef CONFIG_COMPILER_WARN_WRITE_STRINGS
COMMON_WARNING_FLAGS += -Wwrite-strings COMMON_WARNING_FLAGS += -Wwrite-strings

View File

@ -4,3 +4,21 @@
# SDK tool configuration # SDK tool configuration
CONFIG_TARGET_PLATFORM CONFIG_IDF_TARGET CONFIG_TARGET_PLATFORM CONFIG_IDF_TARGET
CONFIG_TOOLPREFIX CONFIG_SDK_TOOLPREFIX CONFIG_TOOLPREFIX CONFIG_SDK_TOOLPREFIX
CONFIG_MAKE_WARN_UNDEFINED_VARIABLES CONFIG_SDK_MAKE_WARN_UNDEFINED_VARIABLES
# Compiler options
CONFIG_OPTIMIZATION_COMPILER CONFIG_COMPILER_OPTIMIZATION
CONFIG_OPTIMIZATION_LEVEL_DEBUG CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG
CONFIG_OPTIMIZATION_LEVEL_RELEASE CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE
CONFIG_OPTIMIZATION_ASSERTION_LEVEL CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL
CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
CONFIG_OPTIMIZATION_ASSERTIONS_SILENT CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
CONFIG_CXX_EXCEPTIONS CONFIG_COMPILER_CXX_EXCEPTIONS
CONFIG_STACK_CHECK_MODE CONFIG_COMPILER_STACK_CHECK_MODE
CONFIG_STACK_CHECK_NONE CONFIG_COMPILER_STACK_CHECK_MODE_NONE
CONFIG_STACK_CHECK_NORM CONFIG_COMPILER_STACK_CHECK_MODE_NORM
CONFIG_STACK_CHECK_STRONG CONFIG_COMPILER_STACK_CHECK_MODE_STRONG
CONFIG_STACK_CHECK_ALL CONFIG_COMPILER_STACK_CHECK_MODE_ALL
CONFIG_STACK_CHECK CONFIG_COMPILER_STACK_CHECK
CONFIG_WARN_WRITE_STRINGS CONFIG_COMPILER_WARN_WRITE_STRINGS