From 22e71e2d710a586226aa84d621ad20560c9b69d9 Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Mon, 14 Mar 2022 19:20:08 +0800 Subject: [PATCH] board/sim: add support of custom optimization level Signed-off-by: chao.an --- arch/Kconfig | 1 + boards/sim/sim/sim/scripts/Make.defs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) 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