2015-06-06 20:01:37 +08:00
|
|
|
|
2015-06-27 04:02:22 +08:00
|
|
|
TEST_OBJS = $(addsuffix .o,$(basename $(wildcard tests/*.S)))
|
2015-06-27 05:14:38 +08:00
|
|
|
FIRMWARE_OBJS = firmware/start.o firmware/irq.o firmware/print.o firmware/sieve.o firmware/multest.o firmware/stats.o
|
2015-06-06 20:01:37 +08:00
|
|
|
|
|
|
|
test: testbench.exe firmware/firmware.hex
|
|
|
|
vvp -N testbench.exe
|
|
|
|
|
2015-06-07 01:22:28 +08:00
|
|
|
test_axi: testbench_axi.exe firmware/firmware.hex
|
|
|
|
vvp -N testbench_axi.exe
|
|
|
|
|
2015-06-06 20:01:37 +08:00
|
|
|
testbench.exe: testbench.v picorv32.v
|
|
|
|
iverilog -o testbench.exe testbench.v picorv32.v
|
|
|
|
chmod -x testbench.exe
|
|
|
|
|
2015-06-07 01:22:28 +08:00
|
|
|
testbench_axi.exe: testbench.v picorv32.v
|
|
|
|
iverilog -o testbench_axi.exe -DAXI_TEST testbench.v picorv32.v
|
|
|
|
chmod -x testbench_axi.exe
|
|
|
|
|
2015-06-06 20:01:37 +08:00
|
|
|
firmware/firmware.hex: firmware/firmware.bin firmware/makehex.py
|
|
|
|
python3 firmware/makehex.py $< > $@
|
|
|
|
|
|
|
|
firmware/firmware.bin: firmware/firmware.elf
|
|
|
|
riscv64-unknown-elf-objcopy -O binary $< $@
|
|
|
|
chmod -x $@
|
|
|
|
|
2015-06-27 04:02:22 +08:00
|
|
|
firmware/firmware.elf: $(FIRMWARE_OBJS) $(TEST_OBJS) firmware/sections.lds
|
2015-06-06 20:01:37 +08:00
|
|
|
riscv64-unknown-elf-gcc -Os -m32 -march=RV32I -ffreestanding -nostdlib -o $@ \
|
|
|
|
-Wl,-Bstatic,-T,firmware/sections.lds,-Map,firmware/firmware.map,--strip-debug \
|
2015-06-27 04:02:22 +08:00
|
|
|
$(FIRMWARE_OBJS) $(TEST_OBJS) -lgcc
|
2015-06-06 20:01:37 +08:00
|
|
|
chmod -x $@
|
|
|
|
|
2015-06-25 20:08:39 +08:00
|
|
|
firmware/start.o: firmware/start.S
|
|
|
|
riscv64-unknown-elf-gcc -c -m32 -o $@ $<
|
|
|
|
|
2015-06-27 04:02:22 +08:00
|
|
|
firmware/%.o: firmware/%.c
|
|
|
|
riscv64-unknown-elf-gcc -c -Os -m32 -march=RV32I -ffreestanding -nostdlib -o $@ $<
|
|
|
|
|
2015-06-06 20:01:37 +08:00
|
|
|
tests/%.o: tests/%.S tests/riscv_test.h tests/test_macros.h
|
|
|
|
riscv64-unknown-elf-gcc -m32 -march=RV32I -c -o $@ -DTEST_FUNC_NAME=$(notdir $(basename $<)) \
|
|
|
|
-DTEST_FUNC_TXT='"$(notdir $(basename $<))"' -DTEST_FUNC_RET=$(notdir $(basename $<))_ret $<
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -vrf $(TEST_OBJS) firmware/firmware.elf firmware/firmware.bin firmware/firmware.hex \
|
|
|
|
firmware/firmware.map testbench.exe testbench.vcd .Xil fsm_encoding.os \
|
|
|
|
synth_vivado.log synth_vivado_*.backup.log synth_vivado.v
|
|
|
|
|
2015-06-07 02:14:58 +08:00
|
|
|
.PHONY: test test_axi clean
|
2015-06-06 20:01:37 +08:00
|
|
|
|