Merge branch 'feature/split_compiler_optimisations' into 'master'

build system: Split setting of compiler optimisation level from assertions on/off

See merge request !886
pull/783/head
Angus Gratton 2017-07-06 10:47:07 +08:00
commit 6d6fd1deda
2 zmienionych plików z 32 dodań i 14 usunięć

41
Kconfig
Wyświetl plik

@ -23,26 +23,41 @@ endmenu
source "$COMPONENT_KCONFIGS_PROJBUILD"
choice OPTIMIZATION_LEVEL
prompt "Optimization level"
menu "Compiler options"
choice OPTIMIZATION_COMPILER
prompt "Optimization Level"
default OPTIMIZATION_LEVEL_DEBUG
help
This option sets optimization level.
- for "Release" setting, -Os flag is added to CFLAGS,
and -DNDEBUG flag is added to CPPFLAGS.
This option sets compiler optimization level (gcc -O argument).
- for "Release" setting, -Os 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
in project makefile, before including $(IDF_PATH)/make/project.mk.
"Release" with -Os produces smaller & faster compiled code but it
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
bool "Debug"
bool "Debug (-Og)"
config OPTIMIZATION_LEVEL_RELEASE
bool "Release"
bool "Release (-Os)"
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"
source "$COMPONENT_KCONFIGS"
endmenu

Wyświetl plik

@ -235,11 +235,14 @@ COMMON_FLAGS = \
# Optimization flags are set based on menuconfig choice
ifneq ("$(CONFIG_OPTIMIZATION_LEVEL_RELEASE)","")
OPTIMIZATION_FLAGS = -Os
CPPFLAGS += -DNDEBUG
else
OPTIMIZATION_FLAGS = -Og
endif
ifeq ("$(CONFIG_OPTIMIZATION_ASSERTIONS)", "")
CPPFLAGS += -DNDEBUG
endif
# Enable generation of debugging symbols
# (we generate even in Release mode, as this has no impact on final binary size.)
DEBUG_FLAGS ?= -ggdb