update espressif risc-v build configuration

- use optimization level O2
- explicitly state risc-v arch
This commit is contained in:
microDev 2022-10-21 17:11:56 +05:30
parent 9c8e6a8698
commit 2285dd1838
No known key found for this signature in database
GPG Key ID: 2C0867BE60967730
1 changed files with 5 additions and 6 deletions

View File

@ -163,12 +163,9 @@ ifeq ($(DEBUG), 1)
# CFLAGS += -fno-inline -fno-ipa-sra
else
CFLAGS += -DNDEBUG -ggdb3
ifeq ($(IDF_TARGET_ARCH),xtensa)
OPTIMIZATION_FLAGS ?= -O2
else
# RISC-V is larger than xtensa so do -Os for it
OPTIMIZATION_FLAGS ?= -Os
endif
# RISC-V is larger than xtensa
# Use -Os for RISC-V when it overflows
endif
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
@ -178,6 +175,8 @@ CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_D
ifeq ($(IDF_TARGET_ARCH),xtensa)
CFLAGS += -mlongcalls
else ifeq ($(IDF_TARGET_ARCH),riscv)
CFLAGS += -march=rv32imc
endif
LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref -Wl,--undefined=uxTopUsedPriority