diff --git a/tests/example/common.mk b/tests/example/common.mk index fa660a7..d38fc3d 100644 --- a/tests/example/common.mk +++ b/tests/example/common.mk @@ -1,5 +1,5 @@ -RISCV_PATH := ../../../tools/gnu-mcu-eclipse-riscv-none-gcc-8.2.0-2.2-20190521-0004-win64/ +RISCV_PATH := $(TOOLCHAIN_DIR)/tools/gnu-mcu-eclipse-riscv-none-gcc-8.2.0-2.2-20190521-0004-win64/ RISCV_GCC := $(abspath $(RISCV_PATH)/bin/riscv-none-embed-gcc) RISCV_AS := $(abspath $(RISCV_PATH)/bin/riscv-none-embed-as) @@ -10,14 +10,9 @@ RISCV_AR := $(abspath $(RISCV_PATH)/bin/riscv-none-embed-ar) RISCV_OBJCOPY := $(abspath $(RISCV_PATH)/bin/riscv-none-embed-objcopy) RISCV_READELF := $(abspath $(RISCV_PATH)/bin/riscv-none-embed-readelf) - - .PHONY: all all: $(TARGET) - -COMMON_DIR = .. - ASM_SRCS += $(COMMON_DIR)/start.S ASM_SRCS += $(COMMON_DIR)/trap_entry.S C_SRCS += $(COMMON_DIR)/init.c @@ -25,7 +20,6 @@ C_SRCS += $(COMMON_DIR)/lib/utils.c C_SRCS += $(COMMON_DIR)/lib/xprintf.c C_SRCS += $(COMMON_DIR)/lib/uart.c - LINKER_SCRIPT := $(COMMON_DIR)/link.lds INCLUDES += -I$(COMMON_DIR) @@ -40,10 +34,9 @@ LINK_DEPS += $(LINKER_SCRIPT) CLEAN_OBJS += $(TARGET) $(LINK_OBJS) $(TARGET).dump $(TARGET).bin -#CFLAGS += -g CFLAGS += -march=$(RISCV_ARCH) CFLAGS += -mabi=$(RISCV_ABI) -CFLAGS += -mcmodel=medany -ffunction-sections -fdata-sections -fno-builtin-printf -fno-builtin-malloc +CFLAGS += -mcmodel=$(RISCV_MCMODEL) -ffunction-sections -fdata-sections -fno-builtin-printf -fno-builtin-malloc $(TARGET): $(LINK_OBJS) $(LINK_DEPS) $(RISCV_GCC) $(CFLAGS) $(INCLUDES) $(LINK_OBJS) -o $@ $(LDFLAGS) diff --git a/tests/example/coremark/Makefile b/tests/example/coremark/Makefile index 3940933..921b3f3 100644 --- a/tests/example/coremark/Makefile +++ b/tests/example/coremark/Makefile @@ -1,5 +1,6 @@ RISCV_ARCH := rv32im RISCV_ABI := ilp32 +RISCV_MCMODEL := medlow TARGET := coremark @@ -15,4 +16,6 @@ CFLAGS := -O2 -fno-common -funroll-loops -finline-functions --param max-inline-i CFLAGS += -DFLAGS_STR=\""$(CFLAGS)"\" CFLAGS += -DITERATIONS=10000 -DPERFORMANCE_RUN=1 +COMMON_DIR = .. +TOOLCHAIN_DIR = ../../.. include ../common.mk diff --git a/tests/example/gpio/Makefile b/tests/example/gpio/Makefile index 5f7ecfd..fb2b7e7 100644 --- a/tests/example/gpio/Makefile +++ b/tests/example/gpio/Makefile @@ -1,5 +1,6 @@ RISCV_ARCH := rv32im RISCV_ABI := ilp32 +RISCV_MCMODEL := medlow TARGET = gpio @@ -15,4 +16,6 @@ C_SRCS := \ main.c \ +COMMON_DIR = .. +TOOLCHAIN_DIR = ../../.. include ../common.mk diff --git a/tests/example/simple/Makefile b/tests/example/simple/Makefile index 7cfead3..5490ad4 100644 --- a/tests/example/simple/Makefile +++ b/tests/example/simple/Makefile @@ -1,5 +1,6 @@ RISCV_ARCH := rv32im RISCV_ABI := ilp32 +RISCV_MCMODEL := medlow TARGET = simple @@ -15,4 +16,6 @@ C_SRCS := \ main.c \ +COMMON_DIR = .. +TOOLCHAIN_DIR = ../../.. include ../common.mk diff --git a/tests/example/timer_int/Makefile b/tests/example/timer_int/Makefile index adb427d..296cc61 100644 --- a/tests/example/timer_int/Makefile +++ b/tests/example/timer_int/Makefile @@ -1,5 +1,6 @@ RISCV_ARCH := rv32im RISCV_ABI := ilp32 +RISCV_MCMODEL := medlow TARGET = timer_int @@ -15,4 +16,6 @@ C_SRCS := \ main.c \ +COMMON_DIR = .. +TOOLCHAIN_DIR = ../../.. include ../common.mk diff --git a/tests/example/uart_tx/Makefile b/tests/example/uart_tx/Makefile index 0c7ca6e..e953c29 100644 --- a/tests/example/uart_tx/Makefile +++ b/tests/example/uart_tx/Makefile @@ -1,5 +1,6 @@ RISCV_ARCH := rv32im RISCV_ABI := ilp32 +RISCV_MCMODEL := medlow TARGET = uart_tx @@ -15,4 +16,6 @@ C_SRCS := \ main.c \ +COMMON_DIR = .. +TOOLCHAIN_DIR = ../../.. include ../common.mk