Skip to content

Commit 2285dd1

Browse files
committed
update espressif risc-v build configuration
- use optimization level O2 - explicitly state risc-v arch
1 parent 9c8e6a8 commit 2285dd1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

ports/espressif/Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,9 @@ ifeq ($(DEBUG), 1)
163163
# CFLAGS += -fno-inline -fno-ipa-sra
164164
else
165165
CFLAGS += -DNDEBUG -ggdb3
166-
ifeq ($(IDF_TARGET_ARCH),xtensa)
167-
OPTIMIZATION_FLAGS ?= -O2
168-
else
169-
# RISC-V is larger than xtensa so do -Os for it
170-
OPTIMIZATION_FLAGS ?= -Os
171-
endif
166+
OPTIMIZATION_FLAGS ?= -O2
167+
# RISC-V is larger than xtensa
168+
# Use -Os for RISC-V when it overflows
172169
endif
173170

174171
# 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
178175

179176
ifeq ($(IDF_TARGET_ARCH),xtensa)
180177
CFLAGS += -mlongcalls
178+
else ifeq ($(IDF_TARGET_ARCH),riscv)
179+
CFLAGS += -march=rv32imc
181180
endif
182181

183182
LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref -Wl,--undefined=uxTopUsedPriority

0 commit comments

Comments
 (0)