aboutsummaryrefslogtreecommitdiffstats
path: root/examples/up5k/Makefile
blob: ea16f06a675865649d53c9b23992a194a8d7e62b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
PROJ = example
PIN_DEF = up5k.pcf
DEVICE = up5k
# Relative paths for easier development without messing with installed version
ARACHNE = ../../../arachne-pnr/bin/arachne-pnr
ARACHNE_ARGS = -c ../../icebox/chipdb-5k.txt
ICEPACK = ../../icepack/icepack
ICETIME = ../../icetime/icetime
ICEPROG = ../../iceprog/iceprog

all: $(PROJ).bin

%.blif: %.v
	yosys -p 'synth_ice40 -top top -blif $@' $<

%.asc: $(PIN_DEF) %.blif
	$(ARACHNE) $(ARACHNE_ARGS) -d $(subst up,,$(subst hx,,$(subst lp,,$(DEVICE)))) -o $@ -p $^

%.bin: %.asc
	$(ICEPACK) $< $@

%.rpt: %.asc
	$(ICETIME) -d $(DEVICE) -mtr $@ $<

prog: $(PROJ).bin
	$(ICEPROG) -S $<

sudo-prog: $(PROJ).bin
	@echo 'Executing prog as root!!!'
	sudo $(ICEPROG) -S $<

clean:
	rm -f $(PROJ).blif $(PROJ).asc $(PROJ).rpt $(PROJ).bin

.SECONDARY:
.PHONY: all prog clean