Skip to content

Commit

Permalink
Fix floating point issues with esp32c3
Browse files Browse the repository at this point in the history
Missing compiler and link flags
Probably since 5.0
  • Loading branch information
mikee47 committed Jan 9, 2024
1 parent ab19a88 commit 7c27775
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Sming/Arch/Esp32/app.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ LDFLAGS += \
-nostdlib \
-Wl,-static

ifdef IDF_TARGET_ARCH_RISCV
LDFLAGS += \
-nostartfiles \
-march=$(ESP32_RISCV_ARCH) \
--specs=nosys.specs
endif

.PHONY: application
application: $(TARGET_BIN)
Expand Down
11 changes: 10 additions & 1 deletion Sming/Arch/Esp32/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ ESP32_COMPILER_PREFIX := xtensa-$(ESP_VARIANT)-elf
else
ESP32_COMPILER_PREFIX := riscv32-esp-elf
IDF_TARGET_ARCH_RISCV := 1
# This is important as no hardware FPU is available on these SOCs
ifeq ($(IDF_VERSION),v5.2)
ESP32_RISCV_ARCH := rv32imc_zicsr_zifencei
else
ESP32_RISCV_ARCH := rv32imc
endif
endif

# $1 => Tool sub-path/name
Expand Down Expand Up @@ -153,7 +159,10 @@ export PROJECT_VER
# Flags which control code generation and dependency generation, both for C and C++
CPPFLAGS += -Wno-frame-address

ifndef IDF_TARGET_ARCH_RISCV
ifdef IDF_TARGET_ARCH_RISCV
CPPFLAGS += \
-march=$(ESP32_RISCV_ARCH)
else
CPPFLAGS += \
-mlongcalls \
-mtext-section-literals
Expand Down

0 comments on commit 7c27775

Please sign in to comment.