picorv32/dhrystone/Makefile

47 lines
1.3 KiB
Makefile
Raw Normal View History

2015-06-06 08:01:37 -04:00
OBJS = start.o dhry_1.o dhry_2.o stdlib.o
CFLAGS = -MD -O3 -m32 -march=RV32I -ffreestanding -nostdlib -DTIME -DRISCV
2015-11-03 12:59:12 -05:00
TOOLCHAIN_PREFIX = riscv32-unknown-elf-
2015-06-06 08:01:37 -04:00
test: testbench.exe dhry.hex
vvp -N testbench.exe
2015-06-07 02:28:10 -04:00
timing: timing.exe dhry.hex
vvp -N timing.exe > timing.txt
sed 's,.*## ,,' timing.txt | gawk 'x != "" {print x,$$2-y;} {x=$$1;y=$$2;}' | sort | uniq -c | sort -k3 -n
2015-06-06 08:01:37 -04:00
testbench.exe: testbench.v ../picorv32.v
iverilog -o testbench.exe testbench.v ../picorv32.v
chmod -x testbench.exe
2015-06-07 02:28:10 -04:00
timing.exe: testbench.v ../picorv32.v
iverilog -o timing.exe -DTIMING testbench.v ../picorv32.v
chmod -x timing.exe
2015-06-06 08:01:37 -04:00
dhry.hex: dhry.bin ../firmware/makehex.py
python3 ../firmware/makehex.py $< 16384 > $@
2015-06-06 08:01:37 -04:00
dhry.bin: dhry.elf
2015-11-03 12:59:12 -05:00
$(TOOLCHAIN_PREFIX)objcopy -O binary $< $@
2015-06-06 08:01:37 -04:00
chmod -x $@
dhry.elf: $(OBJS) ../firmware/sections.lds
2015-11-03 12:59:12 -05:00
$(TOOLCHAIN_PREFIX)gcc $(CFLAGS) -Wl,-Bstatic,-T,../firmware/sections.lds,-Map,dhry.map,--strip-debug -o $@ $(OBJS) -lgcc
2015-06-06 08:01:37 -04:00
chmod -x $@
%.o: %.c
2015-11-03 12:59:12 -05:00
$(TOOLCHAIN_PREFIX)gcc -c $(CFLAGS) $<
2015-06-06 08:01:37 -04:00
%.o: %.S
2015-11-03 12:59:12 -05:00
$(TOOLCHAIN_PREFIX)gcc -c $(CFLAGS) $<
dhry_1.o dhry_2.o: CFLAGS += -Wno-implicit-int -Wno-implicit-function-declaration
2015-06-06 08:01:37 -04:00
clean:
2015-06-07 02:28:10 -04:00
rm -rf *.o *.d dhry.elf dhry.map dhry.bin dhry.hex testbench.exe testbench.vcd timing.exe timing.txt
2015-06-06 08:01:37 -04:00
.PHONY: test clean
-include *.d