-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.ecp5
65 lines (51 loc) · 1.68 KB
/
Makefile.ecp5
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
##
## Make the bitstream for ECP5 boards
##
include common.mk
USBDIR = tinydfu-bootloader/usb
USBSRCS = $(USBDIR)/edge_detect.v \
$(USBDIR)/strobe.v \
$(USBDIR)/usb_fs_in_arb.v \
$(USBDIR)/usb_fs_in_pe.v \
$(USBDIR)/usb_fs_out_arb.v \
$(USBDIR)/usb_fs_out_pe.v \
$(USBDIR)/usb_fs_pe.v \
$(USBDIR)/usb_fs_rx.v \
$(USBDIR)/usb_fs_tx_mux.v \
$(USBDIR)/usb_fs_tx.v \
$(USBDIR)/usb_string_rom.v \
$(USBDIR)/usb_serial_core.v \
$(USBDIR)/usb_serial_ctrl_ep.v \
$(USBDIR)/usb_uart_in_ep.v \
$(USBDIR)/usb_uart_out_ep.v \
$(USBDIR)/usb_phy_ecp5.v
BASENAME ?= vextest
PROJTOP = $(BASENAME)_lbone
SRC = $(PROJTOP).v logicbone_pll.v wb_usb_serial.v $(SOURCES) $(USBSRCS)
PIN_DEF = logicbone-rev0.lpf
#DEVICE = --um5g-85k
DEVICE = --um5g-45k
PACKAGE = CABGA381
all: $(PROJTOP).bit $(PROJTOP).svf
$(PROJTOP).json: $(SRC) firmware.mem
yosys -q -p 'synth_ecp5 -top $(PROJTOP) -json $@' $(filter %.v,$^)
%_out.config: %.json $(PIN_DEF)
nextpnr-ecp5 --json $< --textcfg $@ $(DEVICE) --package $(PACKAGE) --lpf $(PIN_DEF)
%.svf: %_out.config
ecppack --svf $@ $<
%.bit: %_out.config
ecppack --compress --spimode qspi $< $@
dfu: $(PROJTOP).bit
dfu-util -d 1d50:615d -a0 -D $<
firmware.mem:
make -C firmware firmware.bin
hexdump -v -e '"" 1/4 "%08x\n"' firmware/firmware.bin > $@
gui: $(PROJTOP).json $(PIN_DEF)
nextpnr-ecp5 --json $< $(DEVICE) --package $(PACKAGE) --lpf $(PIN_DEF) --gui
# Cleanup Rules
clean:
make -C firmware clean
rm -f $(PROJTOP).json $(PROJTOP).svf $(PROJTOP).bit $(PROJTOP)_out.config
rm -f firmware.mem
.SECONDARY:
.PHONY: all clean dfu gui