ice-display/Makefile

39 lines
843 B
Makefile

YOSYS = yosys
NEXTPNR = nextpnr-ice40
ICEPACK = icepack
DFU_UTIL = dfu-util
BIN2UF2 = bin2uf2
IVERILOG = iverilog
ICETIME = icetime
VVP = vvp
RTL = top.sv spi.sv display.sv
all: gateware.bin
clean:
$(RM) *.json *.asc *.bin *.uf2 *.vcd *.vvp
sim: iverilog.vcd
prog: gateware.bin
$(DFU_UTIL) -d 1209:b1c0 -a 1 -D gateware.bin
prog_flash: gateware.bin
$(DFU_UTIL) -d 1209:b1c0 -a 0 -D gateware.bin -R
gateware.bin: $(RTL)
$(YOSYS) -q -p "read_verilog -sv $(RTL); synth_ice40 -top top -json $*.json"
$(NEXTPNR) -q --randomize-seed --up5k --package sg48 --pcf constraints.pcf --json $*.json --asc $*.asc
$(ICEPACK) $*.asc $@
$(ICETIME) $*.asc -mtd up5k
iverilog.vcd: testbench.sv $(RTL)
$(IVERILOG) -g2012 -Wall -o $*vvp.vvp testbench.sv $(RTL)
$(VVP) $*vvp.vvp $@
.bin.uf2:
$(BIN2UF2) -o $@ $<
.SUFFIXES: .v .sv .asc .bin .uf2