92 lines
2.8 KiB
Makefile
92 lines
2.8 KiB
Makefile
#/*
|
|
# * Copyright {c} 2020-2021, SERI Development Team
|
|
# *
|
|
# * SPDX-License-Identifier: Apache-2.0
|
|
# *
|
|
# * Change Logs:
|
|
# * Date Author Notes
|
|
# * 2022-04-04 Lyons first version
|
|
# */
|
|
|
|
COLORS = "\033[32m"
|
|
COLORE = "\033[0m"
|
|
|
|
.PHONY: help
|
|
help:
|
|
@echo "help - help menu "
|
|
@echo "build - compile c/asm file "
|
|
@echo "compile - compile rtl file "
|
|
@echo "sim - simulate "
|
|
@echo "run - compile and simulate "
|
|
@echo "wave - open wave "
|
|
@echo "xemu - compile and run on xemu (linux platform) "
|
|
|
|
.PHONY: build
|
|
build:
|
|
@echo -e ${COLORS}[INFO] compile c/asm file ...${COLORE}
|
|
${Q}${CC} ${INCLUDES} ${INCFILES} ${CFLAGS} ${LDFLAGS} ${LDLIBS} ${ASMFILES} ${CFILES} -o ${TARGET}.elf
|
|
@echo -e ${COLORS}[INFO] create dump file ...${COLORE}
|
|
${Q}${OBJDUMP} -D -S ${TARGET}.elf > ${TARGET}.dump
|
|
@echo -e ${COLORS}[INFO] create image file ...${COLORE}
|
|
${Q}${OBJCOPY} -S -O binary ${TARGET}.elf ${TARGET}.bin
|
|
${Q}${OBJCOPY} -S -O verilog ${TARGET}.elf image.pat
|
|
ifneq ($(shell uname), Linux)
|
|
${Q}${PROJPATH}/scripts/bin2mi.exe ${TARGET}.bin
|
|
${Q}${CP} rom.mi ${PROJPATH}/riscv-bootloader.mi
|
|
endif
|
|
@echo -e ${COLORS}[INFO] execute done${COLORE}
|
|
|
|
.PHONY: compile
|
|
compile:
|
|
@echo -e ${COLORS}[INFO] compile design file ...${COLORE}
|
|
ifneq ($(shell uname), Linux)
|
|
${Q}${VCS} -g2012 -o wave.vvp ${ALLDEFINE} -f ${PROJPATH}/fpga_project/src//design.f ${TBFILES}
|
|
else
|
|
${Q}${VCS} -Mupdate -sverilog +v2k -debug_pp -timescale="1ns/100ps" ${ALLDEFINE} \
|
|
-f ${PROJPATH}/fpga_project/src//design.f ${TBFILES} \
|
|
-l compile.log
|
|
endif
|
|
@echo -e ${COLORS}[INFO] execute done${COLORE}
|
|
|
|
.PHONY: sim
|
|
sim:
|
|
@echo -e ${COLORS}[INFO] simulate ...${COLORE}
|
|
ifneq ($(shell uname), Linux)
|
|
${Q}${SIM} -n wave.vvp -lxt2
|
|
else
|
|
${Q}${SIM} -l sim.log
|
|
endif
|
|
@echo -e ${COLORS}[INFO] execute done${COLORE}
|
|
|
|
.PHONY: run
|
|
run: build compile sim
|
|
|
|
.PHONY: wave
|
|
wave:
|
|
@echo -e ${COLORS}[INFO] open wave ...${COLORE}
|
|
ifneq ($(shell uname), Linux)
|
|
${Q}${WAV} wave.vcd &
|
|
else
|
|
${Q}${WAV} -full64 -vpd wave.vpd &
|
|
endif
|
|
@echo -e ${COLORS}[INFO] execute done${COLORE}
|
|
|
|
.PHONY: xemu
|
|
xemu:
|
|
@echo -e ${COLORS}[INFO] compile xemu ...${COLORE}
|
|
${Q}make -C ${WORKPATH}/../xemu build
|
|
@echo -e ${COLORS}[INFO] simulate ...${COLORE}
|
|
ifneq ($(shell uname), Linux)
|
|
${Q}${WORKPATH}/../xemu/xemu.exe ${TARGET}.bin
|
|
else
|
|
${Q}${WORKPATH}/../xemu/xemu ${TARGET}.bin
|
|
endif
|
|
@echo -e ${COLORS}[INFO] execute done${COLORE}
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
@echo -e ${COLORS}[INFO] clean project ...${COLORE}
|
|
@make -C ${WORKPATH}/../xemu clean
|
|
@ls | grep -vE "Makefile|driver|rtthread-nano|*\.lds$$|*\.c$$|*\.h$$" | xargs -i rm -rf {}
|
|
@echo -e ${COLORS}[INFO] execute done${COLORE}
|