summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bsp/coreip-e24-arty/settings.mk1
-rw-r--r--bsp/coreip-e31-arty/settings.mk1
-rw-r--r--bsp/coreip-e31/settings.mk1
-rw-r--r--bsp/coreip-s51-arty/settings.mk1
-rw-r--r--bsp/coreip-s51/settings.mk1
-rw-r--r--bsp/freedom-e310-arty/settings.mk1
-rw-r--r--bsp/sifive-hifive1/settings.mk1
-rw-r--r--scripts/libmetal.mk2
-rw-r--r--scripts/standalone.mk8
9 files changed, 14 insertions, 3 deletions
diff --git a/bsp/coreip-e24-arty/settings.mk b/bsp/coreip-e24-arty/settings.mk
index 31143b5..829d3e8 100644
--- a/bsp/coreip-e24-arty/settings.mk
+++ b/bsp/coreip-e24-arty/settings.mk
@@ -1,2 +1,3 @@
RISCV_ARCH=rv32imac
RISCV_ABI=ilp32
+RISCV_CMODEL=medlow
diff --git a/bsp/coreip-e31-arty/settings.mk b/bsp/coreip-e31-arty/settings.mk
index 31143b5..829d3e8 100644
--- a/bsp/coreip-e31-arty/settings.mk
+++ b/bsp/coreip-e31-arty/settings.mk
@@ -1,2 +1,3 @@
RISCV_ARCH=rv32imac
RISCV_ABI=ilp32
+RISCV_CMODEL=medlow
diff --git a/bsp/coreip-e31/settings.mk b/bsp/coreip-e31/settings.mk
index 0c818ec..32bb84d 100644
--- a/bsp/coreip-e31/settings.mk
+++ b/bsp/coreip-e31/settings.mk
@@ -2,4 +2,5 @@
RISCV_ARCH=rv32imac
RISCV_ABI=ilp32
+RISCV_CMODEL=medlow
COREIP_MEM_WIDTH=32
diff --git a/bsp/coreip-s51-arty/settings.mk b/bsp/coreip-s51-arty/settings.mk
index 1627f4b..3f994a3 100644
--- a/bsp/coreip-s51-arty/settings.mk
+++ b/bsp/coreip-s51-arty/settings.mk
@@ -1,2 +1,3 @@
RISCV_ARCH=rv64imac
RISCV_ABI=lp64
+RISCV_CMODEL=medany
diff --git a/bsp/coreip-s51/settings.mk b/bsp/coreip-s51/settings.mk
index 553417e..a3cd0bb 100644
--- a/bsp/coreip-s51/settings.mk
+++ b/bsp/coreip-s51/settings.mk
@@ -1,3 +1,4 @@
RISCV_ARCH=rv64imac
RISCV_ABI=lp64
COREIP_MEM_WIDTH=64
+RISCV_CMODEL=medany
diff --git a/bsp/freedom-e310-arty/settings.mk b/bsp/freedom-e310-arty/settings.mk
index eacecc3..b7a7782 100644
--- a/bsp/freedom-e310-arty/settings.mk
+++ b/bsp/freedom-e310-arty/settings.mk
@@ -2,3 +2,4 @@
RISCV_ARCH=rv32imac
RISCV_ABI=ilp32
+RISCV_CMODE=medlow
diff --git a/bsp/sifive-hifive1/settings.mk b/bsp/sifive-hifive1/settings.mk
index b9424bc..fd73559 100644
--- a/bsp/sifive-hifive1/settings.mk
+++ b/bsp/sifive-hifive1/settings.mk
@@ -1,2 +1,3 @@
RISCV_ARCH = rv32imac
RISCV_ABI = ilp32
+RISCV_CMODEL = medlow
diff --git a/scripts/libmetal.mk b/scripts/libmetal.mk
index ea16632..6e6aada 100644
--- a/scripts/libmetal.mk
+++ b/scripts/libmetal.mk
@@ -13,7 +13,7 @@ $(BSP_DIR)/build/Makefile:
@rm -rf $(dir $@)
@mkdir -p $(dir $@)
cd $(dir $@) && \
- CFLAGS="-march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffunction-sections -fdata-sections -g -mcmodel=medany" \
+ CFLAGS="-march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffunction-sections -fdata-sections -g -mcmodel=$(RISCV_CMODEL)" \
$(abspath $(MEE_SOURCE_PATH)/configure) \
--host=$(CROSS_COMPILE) \
--prefix=$(abspath $(BSP_DIR)/install) \
diff --git a/scripts/standalone.mk b/scripts/standalone.mk
index e5f2ff7..e80e0c1 100644
--- a/scripts/standalone.mk
+++ b/scripts/standalone.mk
@@ -28,6 +28,10 @@ ifeq ($(RISCV_ABI),)
$(error $(BSP_DIR)/board.mk must set RISCV_ABI, the ABI to target)
endif
+ifeq ($(RISCV_CMODEL),)
+RISCV_CMODEL = medany
+endif
+
# Determines the XLEN from the toolchain tuple
ifeq ($(patsubst rv32%,rv32,$(RISCV_ARCH)),rv32)
RISCV_XLEN := 32
@@ -92,8 +96,8 @@ $(PROGRAM_ELF): \
AR=$(RISCV_AR) \
CC=$(RISCV_GCC) \
CXX=$(RISCV_GXX) \
- CFLAGS="-Os -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffunction-sections -fdata-sections -g -mcmodel=medany -I$(abspath $(BSP_DIR)/install/include/)" \
- CXXFLAGS="-Os -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffunction-sections -fdata-sections -g -mcmodel=medany -I$(abspath $(BSP_DIR)/install/include/)" \
+ CFLAGS="-Os -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffunction-sections -fdata-sections -g -mcmodel=$(RISCV_CMODEL) -I$(abspath $(BSP_DIR)/install/include/)" \
+ CXXFLAGS="-Os -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffunction-sections -fdata-sections -g -mcmodel=$(RISCV_CMODEL) -I$(abspath $(BSP_DIR)/install/include/)" \
LDFLAGS="-nostartfiles -nostdlib -L$(sort $(dir $(abspath $(filter %.a,$^)))) -T$(abspath $(filter %.lds,$^))" \
LDLIBS="-Wl,--gc-sections -Wl,--start-group -lc -lgcc -lmetal -lmetal-gloss -Wl,--end-group"
touch -c $@