diff --git a/arch/Kconfig b/arch/Kconfig index 1c8903a021..f750b8f509 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -85,6 +85,7 @@ config ARCH_SIM select ARCH_HAVE_TESTSET select ARCH_HAVE_VFORK select ARCH_HAVE_SETJMP + select ARCH_HAVE_CUSTOMOPT select ARCH_SETJMP_H select ALARM_ARCH select ONESHOT diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs index dc9ca66987..8dedaace16 100644 --- a/boards/sim/sim/sim/scripts/Make.defs +++ b/boards/sim/sim/sim/scripts/Make.defs @@ -45,8 +45,14 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y) ARCHOPTIMIZATIONRUST = -g endif +ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y) + MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL) +else + MAXOPTIMIZATION ?= -O2 +endif + ifneq ($(CONFIG_DEBUG_NOOPT),y) - ARCHOPTIMIZATION += -O2 -fno-strict-aliasing + ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing else ARCHOPTIMIZATIONRUST += -C opt-level=0 endif