From 6ff0161882ae1d85435ba4337d6d23e82c8f1057 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 2 Dec 2023 17:41:14 +0100 Subject: [PATCH] adds some consistency fixes for variable ISA settings --- bare-metal-bsp/env/common-gcc.mk | 2 +- bare-metal-bsp/env/iss/link.lds | 2 +- bare-metal-bsp/env/rtl/link.lds | 1 - benchmarks/coremark/tgc/core_portme.mak | 10 +++++----- benchmarks/dhrystone/Makefile | 1 - benchmarks/dhrystone/dhry_stubs.c | 2 +- hello-world/Makefile | 10 ++++++++-- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bare-metal-bsp/env/common-gcc.mk b/bare-metal-bsp/env/common-gcc.mk index ffe4d6b..9e724c5 100644 --- a/bare-metal-bsp/env/common-gcc.mk +++ b/bare-metal-bsp/env/common-gcc.mk @@ -24,7 +24,7 @@ INCLUDES += -I$(PLATFORM_DIR) TOOL_DIR ?= $(BSP_BASE)/../toolchain/bin/ LDFLAGS += -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -LDFLAGS += -T $(LINKER_SCRIPT) -Wl,-Map=$(TARGET).map -nostartfiles +LDFLAGS += -T $(LINKER_SCRIPT) -Wl,--no-warn-rwx-segments -Wl,-Map=$(TARGET).map -nostartfiles LDFLAGS += -L$(ENV_DIR) # --specs=nano.specs diff --git a/bare-metal-bsp/env/iss/link.lds b/bare-metal-bsp/env/iss/link.lds index 575c22e..fa8bccf 100644 --- a/bare-metal-bsp/env/iss/link.lds +++ b/bare-metal-bsp/env/iss/link.lds @@ -4,7 +4,7 @@ ENTRY( _start ) MEMORY { - flash (rxai!w) : ORIGIN = 0x00000020, LENGTH = 1M + flash (rxai!w) : ORIGIN = 0x00000000, LENGTH = 1M ram (wxa!ri) : ORIGIN = 0x10000000, LENGTH = 16K } diff --git a/bare-metal-bsp/env/rtl/link.lds b/bare-metal-bsp/env/rtl/link.lds index adab24c..fa8bccf 100644 --- a/bare-metal-bsp/env/rtl/link.lds +++ b/bare-metal-bsp/env/rtl/link.lds @@ -169,7 +169,6 @@ SECTIONS PROVIDE( _sp = . ); } >ram AT>ram :ram - #PROVIDE( tohost = 0x00018000 ); PROVIDE( tohost = 0xfffffff0 ); PROVIDE( fromhost = 0xfffffff8 ); } diff --git a/benchmarks/coremark/tgc/core_portme.mak b/benchmarks/coremark/tgc/core_portme.mak index c2802d9..4d64e23 100755 --- a/benchmarks/coremark/tgc/core_portme.mak +++ b/benchmarks/coremark/tgc/core_portme.mak @@ -18,19 +18,19 @@ ISA?=imc RISCV_ARCH:=rv32$(ISA) RISCV_ABI:=ilp32 - +TRIPLET?=riscv64-unknown-elf # Flag : OUTFLAG # Use this flag to define how to to get an executable (e.g -o) OUTFLAG= -o # Flag : CC # Use this flag to define compiler to use -CC = riscv32-unknown-elf-gcc +CC = $(TRIPLET)-gcc # Flag : LD # Use this flag to define compiler to use -LD = riscv32-unknown-elf-gcc +LD = $(TRIPLET)-gcc # Flag : AS # Use this flag to define compiler to use -AS = riscv32-unknown-elf-as +AS = $(TRIPLET)-as # Flag : CFLAGS # Use this flag to define compiler options. Note, you can add compiler options from the command line using XCFLAGS="other flags" PORT_CFLAGS = -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -O3 -DCLOCKS_PER_SEC=10000000 -nostdlib -nostartfiles -nodefaultlibs \ @@ -44,7 +44,7 @@ SEPARATE_COMPILE=1 # Flag : SEPARATE_COMPILE # You must also define below how to create an object file, and how to link. OBJOUT = -o -LFLAGS = +LFLAGS = -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) #--specs=nano.specs -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) ASFLAGS = OFLAG = -o diff --git a/benchmarks/dhrystone/Makefile b/benchmarks/dhrystone/Makefile index b6750e8..008ff5a 100644 --- a/benchmarks/dhrystone/Makefile +++ b/benchmarks/dhrystone/Makefile @@ -20,6 +20,5 @@ LDFLAGS := -g -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -mcmodel=medlow -Wl,--wrap TOOL_DIR=$(dir $(compiler)) -TRIPLET=riscv32-unknown-elf BSP_BASE = ../../bare-metal-bsp include $(BSP_BASE)/env/common-gcc.mk diff --git a/benchmarks/dhrystone/dhry_stubs.c b/benchmarks/dhrystone/dhry_stubs.c index d8a1eb7..9dfdda0 100644 --- a/benchmarks/dhrystone/dhry_stubs.c +++ b/benchmarks/dhrystone/dhry_stubs.c @@ -16,7 +16,7 @@ void __wrap_scanf(const char* fmt, int* n) extern volatile uint32_t tohost; -void __wrap_exit(int n){ +void exit(int n){ tohost = 0x1; for (;;); } diff --git a/hello-world/Makefile b/hello-world/Makefile index 17feac9..50b9179 100644 --- a/hello-world/Makefile +++ b/hello-world/Makefile @@ -1,5 +1,7 @@ TARGET = hello +ISA?=imc + C_SRCS = $(wildcard *.c) HEADERS = $(wildcard *.h) OPT ?= -O2 @@ -7,8 +9,12 @@ CFLAGS += $(OPT) -g BOARD=iss LINK_TARGET=link -RISCV_ARCH:=rv32e -RISCV_ABI:=ilp32e +RISCV_ARCH:=rv32$(ISA) +ifeq ($(ISA),e) + RISCV_ABI:=ilp32e +else + RISCV_ABI:=ilp32 +endif LDFLAGS += -g -Wl,--wrap=printf compiler := $(shell which riscv64-unknown-elf-gcc)