summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 38 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a1842aa
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,38 @@
+TOP = top
+OBJS = top.v blink.v
+
+FREQ_MHZ = 65
+DEVICE_TYPE = 25k
+PACKAGE = CABGA256
+SPEED_GRADE = 6
+
+.PHONY: all clean program
+all: $(TOP).svf
+
+clean:
+ rm -f *.svf *.bit *.json
+
+program: $(TOP).svf
+ # probably not very useful to anyone without more configurable paths
+ openocd -f /usr/share/openocd/scripts/interface/ftdi/dp_busblaster_kt-link.cfg \
+ -f ~/jtag/5a-75e.cfg \
+ -c "init; svf $^; shutdown"
+
+%.json: $(OBJS)
+ yosys -p "synth_ecp5 -json $@" $(OBJS)
+
+%.config: %.json %.lpf
+ nextpnr-ecp5 \
+ --$(DEVICE_TYPE) \
+ --package $(PACKAGE) \
+ --speed $(SPEED_GRADE) \
+ --freq $(FREQ_MHZ) \
+ --json $< \
+ --textcfg $@ \
+ --lpf $(word 2,$^)
+
+%.bit %.svf: %.config
+ ecppack \
+ --bit "$*.bit" \
+ --svf "$*.svf" \
+ --input "$^"