diff --git a/.gitmodules b/.gitmodules index ddd97f0..34ccdc6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "tgc-iss/dbt-rise-tgc"] path = tgc-iss/dbt-rise-tgc url = https://git.minres.com/DBT-RISE/DBT-RISE-TGC.git +[submodule "fw/bsp"] + path = fw/bsp + url = https://git.minres.com/Firmware/MNRS-BM-BSP.git diff --git a/fw/bsp b/fw/bsp new file mode 160000 index 0000000..71c7fd6 --- /dev/null +++ b/fw/bsp @@ -0,0 +1 @@ +Subproject commit 71c7fd698176a45313b50428905837b444050aa9 diff --git a/fw/hello-world/.gitignore b/fw/hello-world/.gitignore index ebea2da..0ccceea 100644 --- a/fw/hello-world/.gitignore +++ b/fw/hello-world/.gitignore @@ -1,3 +1,3 @@ /hello /hello.dis -/firmware.map +/hello.map diff --git a/fw/hello-world/Makefile b/fw/hello-world/Makefile index 6e7d998..4995b74 100644 --- a/fw/hello-world/Makefile +++ b/fw/hello-world/Makefile @@ -1,17 +1,28 @@ TARGET = hello +ISA?=imc + C_SRCS = $(wildcard *.c) HEADERS = $(wildcard *.h) -CFLAGS += -O0 -g +OPT ?= -O2 +CFLAGS += $(OPT) -g -BOARD=tgfs-vp -LINK_TARGET=flash -RISCV_ARCH:=rv32i -RISCV_ABI:=ilp32 -LDFLAGS := -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) +BOARD=tgc_vp +LINK_TARGET=link +RISCV_ARCH:=rv32$(ISA) +ifeq ($(ISA),e) + RISCV_ABI:=ilp32e +else + RISCV_ABI:=ilp32 +endif +LDFLAGS += -g -Wl,--wrap=printf -compiler := $(shell which riscv32-unknown-elf-gcc) +compiler := $(shell which riscv64-unknown-elf-gcc) TOOL_DIR=$(dir $(compiler)) +TRIPLET=riscv64-unknown-elf BSP_BASE = ../bsp include $(BSP_BASE)/env/common-gcc.mk + +$(TARGET).vlog:$(TARGET) + riscv32-unknown-elf-objcopy -O verilog $(TARGET) $(TARGET).vlog diff --git a/fw/hello-world/hello.c b/fw/hello-world/hello.c index b687874..219ed8a 100644 --- a/fw/hello-world/hello.c +++ b/fw/hello-world/hello.c @@ -17,8 +17,6 @@ int factorial(int i){ int main() { - *(uint32_t*)(GPIO_CTRL_ADDR+GPIO_IOF_SEL) &= ~IOF0_UART0_MASK; - *(uint32_t*)(GPIO_CTRL_ADDR+GPIO_IOF_EN) |= IOF0_UART0_MASK; volatile int result = factorial (10); printf("Factorial is %d\n", result); printf("End of execution"); diff --git a/fw/hello-world/prebuilt/hello.elf b/fw/hello-world/prebuilt/hello.elf index 9b63df7..bebbe7c 100755 Binary files a/fw/hello-world/prebuilt/hello.elf and b/fw/hello-world/prebuilt/hello.elf differ