summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDino Li <Dino.Li@ite.com.tw>2020-06-03 17:07:05 +0800
committerCommit Bot <commit-bot@chromium.org>2020-08-20 08:35:49 +0000
commit381ff0ad0a67fe74eeb41d4fdfc08de710349fd6 (patch)
tree333267f4a0536a03e2b99c0943f591f98a7ebf68
parent3ba08d0ca0e423d9717d7c447bef1b9a658b08c7 (diff)
downloadchrome-ec-381ff0ad0a67fe74eeb41d4fdfc08de710349fd6.tar.gz
riscv-rv32i: Enable FPU extension only if CONFIG_FPU is enabled
At default, CONFIG_FPU option isn't enabled. But currently, FPU extension is always enabled when building FW image. This will cause problem if hardware doesn't support the extension and floating-point instructions are generated. So we fix it. BUG=none BRANCH=none TEST=Floating-point instructions are used for floating point operation if CONFIG_FPU is enabled. Otherwise, library routines are used. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: Ifb77bd0cca1158ca7f6637fa9ec025ac8712bbfd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2227779 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--core/riscv-rv32i/build.mk4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/riscv-rv32i/build.mk b/core/riscv-rv32i/build.mk
index c8d7328a3a..a69e2ecafc 100644
--- a/core/riscv-rv32i/build.mk
+++ b/core/riscv-rv32i/build.mk
@@ -10,8 +10,10 @@
$(call set-option,CROSS_COMPILE,$(CROSS_COMPILE_riscv),\
/opt/coreboot-sdk/bin/riscv64-elf-)
+# Enable FPU extension if config option of FPU is enabled.
+_FPU_EXTENSION=$(if $(CONFIG_FPU),f,)
# CPU specific compilation flags
-CFLAGS_CPU+=-march=rv32imafc -mabi=ilp32f -Os
+CFLAGS_CPU+=-march=rv32ima$(_FPU_EXTENSION)c -mabi=ilp32$(_FPU_EXTENSION) -Os
LDFLAGS_EXTRA+=-mrelax
LDFLAGS_EXTRA+=-static-libgcc -lgcc