picorv32/dhrystone/Makefile

50 lines
1.4 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
2016-04-10 10:55:10 -04:00
CFLAGS = -MD -O3 -m32 -march=RV32IM -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.vvp dhry.hex
vvp -N testbench.vvp
2015-06-06 08:01:37 -04:00
timing: timing.txt
grep '^##' timing.txt | gawk 'x != "" {print x,$$3-y;} {x=$$2;y=$$3;}' | sort | uniq -c | \
gawk '{printf("%03d-%-7s %2d %-8s (%d)\n",$$3,$$2,$$3,$$2,$$1);}' | sort | cut -c13-
timing.txt: timing.vvp dhry.hex
vvp -N timing.vvp > timing.txt
2015-06-07 02:28:10 -04:00
testbench.vvp: testbench.v ../picorv32.v
iverilog -o testbench.vvp testbench.v ../picorv32.v
chmod -x testbench.vvp
2015-06-06 08:01:37 -04:00
timing.vvp: testbench.v ../picorv32.v
iverilog -o timing.vvp -DTIMING testbench.v ../picorv32.v
chmod -x timing.vvp
2015-06-07 02:28:10 -04:00
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:
rm -rf *.o *.d dhry.elf dhry.map dhry.bin dhry.hex testbench.vvp testbench.vcd timing.vvp timing.txt
2015-06-06 08:01:37 -04:00
.PHONY: test clean
-include *.d