-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.ice40
63 lines (50 loc) · 1.61 KB
/
Makefile.ice40
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
##
## Make the bitstream for iCE40 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_ice40.v
BASENAME ?= vextest
PROJTOP = $(BASENAME)_tbx
SRC = $(PROJTOP).v tinyfpga_pll.v wb_usb_serial.v $(SOURCES) $(USBSRCS)
PIN_DEF = pins.pcf
DEVICE = --lp8k
PACKAGE = cm81
CLK_MHZ = 48
all: $(PROJTOP).bit
tinyfpga_pll.v:
icepll -i 16 -o $(CLK_MHZ) -m -f $@
$(PROJTOP).json: $(SRC) firmware.mem
yosys -q -p 'synth_ice40 -top $(PROJTOP) -json $@' $(filter %.v,$^)
%.asc: %.json $(PIN_DEF)
nextpnr-ice40 --json $< --asc $@ $(DEVICE) --package $(PACKAGE) --pcf $(PIN_DEF) --opt-timing
%.bit: %.asc
icepack $< $@
# Firmware Build Rules.
firmware.mem:
make -C firmware firmware.bin
hexdump -v -e '"" 1/4 "%08x\n"' firmware/firmware.bin > $@
gui: $(PROJTOP).json $(PIN_DEF)
nextpnr-ice40 --json $< $(DEVICE) --package $(PACKAGE) --pcf $(PIN_DEF) --opt-timing --gui
# Cleanup Rules
clean:
make -C firmware clean
rm -f $(PROJTOP).json $(PROJTOP).svf $(PROJTOP).bit $(PROJTOP).asc $(PROJTOP).hex
rm -f firmware.mem
.SECONDARY:
.PHONY: all clean gui