kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'feature/split_compiler_optimisations' into 'master'
build system: Split setting of compiler optimisation level from assertions on/off See merge request !886pull/783/head
commit
6d6fd1deda
35
Kconfig
35
Kconfig
|
@ -23,26 +23,41 @@ endmenu
|
||||||
|
|
||||||
source "$COMPONENT_KCONFIGS_PROJBUILD"
|
source "$COMPONENT_KCONFIGS_PROJBUILD"
|
||||||
|
|
||||||
choice OPTIMIZATION_LEVEL
|
menu "Compiler options"
|
||||||
prompt "Optimization level"
|
|
||||||
|
choice OPTIMIZATION_COMPILER
|
||||||
|
prompt "Optimization Level"
|
||||||
default OPTIMIZATION_LEVEL_DEBUG
|
default OPTIMIZATION_LEVEL_DEBUG
|
||||||
help
|
help
|
||||||
This option sets optimization level.
|
This option sets compiler optimization level (gcc -O argument).
|
||||||
|
|
||||||
- for "Release" setting, -Os flag is added to CFLAGS,
|
|
||||||
and -DNDEBUG flag is added to CPPFLAGS.
|
|
||||||
|
|
||||||
|
- for "Release" setting, -Os flag is added to CFLAGS.
|
||||||
- for "Debug" setting, -Og flag is added to CFLAGS.
|
- for "Debug" setting, -Og flag is added to CFLAGS.
|
||||||
|
|
||||||
To override any of these settings, set CFLAGS and/or CPPFLAGS
|
"Release" with -Os produces smaller & faster compiled code but it
|
||||||
in project makefile, before including $(IDF_PATH)/make/project.mk.
|
may be harder to correlated code addresses to source files when debugging.
|
||||||
|
|
||||||
|
To add custom optimization settings, set CFLAGS and/or CPPFLAGS
|
||||||
|
in project makefile, before including $(IDF_PATH)/make/project.mk. Note that
|
||||||
|
custom optimization levels may be unsupported.
|
||||||
|
|
||||||
config OPTIMIZATION_LEVEL_DEBUG
|
config OPTIMIZATION_LEVEL_DEBUG
|
||||||
bool "Debug"
|
bool "Debug (-Og)"
|
||||||
config OPTIMIZATION_LEVEL_RELEASE
|
config OPTIMIZATION_LEVEL_RELEASE
|
||||||
bool "Release"
|
bool "Release (-Os)"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
config OPTIMIZATION_ASSERTIONS
|
||||||
|
prompt "Enable assertions"
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable assertions.
|
||||||
|
|
||||||
|
If disabled, -DNDEBUG is added to CFLAGS.
|
||||||
|
|
||||||
|
endmenu # Optimization level
|
||||||
|
|
||||||
menu "Component config"
|
menu "Component config"
|
||||||
source "$COMPONENT_KCONFIGS"
|
source "$COMPONENT_KCONFIGS"
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -235,11 +235,14 @@ COMMON_FLAGS = \
|
||||||
# Optimization flags are set based on menuconfig choice
|
# Optimization flags are set based on menuconfig choice
|
||||||
ifneq ("$(CONFIG_OPTIMIZATION_LEVEL_RELEASE)","")
|
ifneq ("$(CONFIG_OPTIMIZATION_LEVEL_RELEASE)","")
|
||||||
OPTIMIZATION_FLAGS = -Os
|
OPTIMIZATION_FLAGS = -Os
|
||||||
CPPFLAGS += -DNDEBUG
|
|
||||||
else
|
else
|
||||||
OPTIMIZATION_FLAGS = -Og
|
OPTIMIZATION_FLAGS = -Og
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ("$(CONFIG_OPTIMIZATION_ASSERTIONS)", "")
|
||||||
|
CPPFLAGS += -DNDEBUG
|
||||||
|
endif
|
||||||
|
|
||||||
# Enable generation of debugging symbols
|
# Enable generation of debugging symbols
|
||||||
# (we generate even in Release mode, as this has no impact on final binary size.)
|
# (we generate even in Release mode, as this has no impact on final binary size.)
|
||||||
DEBUG_FLAGS ?= -ggdb
|
DEBUG_FLAGS ?= -ggdb
|
||||||
|
|
Ładowanie…
Reference in New Issue