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


BOARD=freedom-e300-hifive1
LINK_TARGET=flash
RISCV_ARCH=rv32imac
RISCV_ABI=ilp32

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

.PHONY: all
all: $(TARGET).dump

$(TARGET).dump: $(TARGET)
	$(TOOL_DIR)/$(TRIPLET)-objdump -d -S -C $< > $@

	