add toolchain and mcmodel configuration

Signed-off-by: liangkangnan <liangkangnan@163.com>
pull/1/head
liangkangnan 2020-04-18 21:27:26 +08:00
parent ea9b4de53d
commit f1f89f7bf5
6 changed files with 17 additions and 9 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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