diff --git a/hello-world/Makefile b/hello-world/Makefile index 92a6582..038e966 100644 --- a/hello-world/Makefile +++ b/hello-world/Makefile @@ -1,14 +1,16 @@ -TARGET = hello -C_SRCS += $(wildcard *.c) +TARGET = hello +C_SRCS = $(wildcard *.c) +#HEADERS = $(wildcard *.h) #CFLAGS += -O2 -#-fno-builtin-printf BOARD=freedom-e300-hifive1 LINK_TARGET=link RISCV_ARCH=rv32imac RISCV_ABI=ilp32 +LDFLAGS = -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -mcmodel=medany + TOOL_DIR?=/opt/riscv/FreedomStudio/20180122/SiFive/riscv64-unknown-elf-gcc-20171231-x86_64-linux-centos6/bin BSP_BASE = ./bsp include $(BSP_BASE)/env/common.mk diff --git a/hello-world/bsp/env/common.mk b/hello-world/bsp/env/common.mk index 241f81d..0ca2c70 100644 --- a/hello-world/bsp/env/common.mk +++ b/hello-world/bsp/env/common.mk @@ -44,6 +44,7 @@ TRIPLET?=riscv64-unknown-elf CXX=$(TOOL_DIR)/$(TRIPLET)-c++ CC=$(TOOL_DIR)/$(TRIPLET)-gcc LD=$(TOOL_DIR)/$(TRIPLET)-gcc +AR=$(TOOL_DIR)/$(TRIPLET)-ar $(TARGET): $(LINK_OBJS) $(LINK_DEPS) @@ -60,6 +61,6 @@ $(CXX_OBJS): %.o: %.cpp $(HEADERS) .PHONY: clean clean: - rm -f $(CLEAN_OBJS) + rm -f $(CLEAN_OBJS) $(LIBWRAP) endif # _SIFIVE_MK_COMMON diff --git a/hello-world/hello b/hello-world/hello index 74933cf..7e3e709 100755 Binary files a/hello-world/hello and b/hello-world/hello differ diff --git a/riscv-bldc-forced-commutation/Makefile b/riscv-bldc-forced-commutation/Makefile index c32284c..cb58bf6 100644 --- a/riscv-bldc-forced-commutation/Makefile +++ b/riscv-bldc-forced-commutation/Makefile @@ -3,11 +3,10 @@ TARGET = riscv-bldc C_SRCS = $(wildcard src/*.c) $(BSP_BASE)/drivers/fe300prci/fe300prci_driver.c $(BSP_BASE)/drivers/plic/plic_driver.c CXX_SRCS = $(wildcard src/*.cpp) HEADERS = $(wildcard src/*.h) -CFLAGS = -g -CFLAGS += -fno-builtin-printf -DUSE_PLIC -DUSE_M_TIME -DNO_INIT -I./src +CFLAGS = -g -fno-builtin-printf -DUSE_PLIC -DUSE_M_TIME -DNO_INIT -I./src CXXFLAGS = -fno-use-cxa-atexit LDFLAGS = -Wl,--wrap=printf -LDFLAGS += -g -lstdc++ -fno-use-cxa-atexit -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -mcmodel=medany +LDFLAGS = -g -lstdc++ -fno-use-cxa-atexit -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -mcmodel=medany BOARD=freedom-e300-hifive1 diff --git a/riscv-bldc-forced-commutation/bsp/env/common.mk b/riscv-bldc-forced-commutation/bsp/env/common.mk index 241f81d..0ca2c70 100644 --- a/riscv-bldc-forced-commutation/bsp/env/common.mk +++ b/riscv-bldc-forced-commutation/bsp/env/common.mk @@ -44,6 +44,7 @@ TRIPLET?=riscv64-unknown-elf CXX=$(TOOL_DIR)/$(TRIPLET)-c++ CC=$(TOOL_DIR)/$(TRIPLET)-gcc LD=$(TOOL_DIR)/$(TRIPLET)-gcc +AR=$(TOOL_DIR)/$(TRIPLET)-ar $(TARGET): $(LINK_OBJS) $(LINK_DEPS) @@ -60,6 +61,6 @@ $(CXX_OBJS): %.o: %.cpp $(HEADERS) .PHONY: clean clean: - rm -f $(CLEAN_OBJS) + rm -f $(CLEAN_OBJS) $(LIBWRAP) endif # _SIFIVE_MK_COMMON