36 lines
887 B
Makefile
36 lines
887 B
Makefile
# Project setup
|
|
PROJ = syrostan_fpga
|
|
BUILD = ./build
|
|
DEVICE = 8k
|
|
FOOTPRINT = ct256
|
|
|
|
# Files
|
|
FILES = top.v
|
|
|
|
.PHONY: all clean burn
|
|
|
|
all:
|
|
# if build folder doesn't exist, create it
|
|
mkdir -p $(BUILD)
|
|
# synthesize using Yosys
|
|
yosys -p "synth_ice40 -top top -blif $(BUILD)/$(PROJ).blif" $(FILES)
|
|
# Place and route using arachne
|
|
arachne-pnr -d $(DEVICE) -P $(FOOTPRINT) -o $(BUILD)/$(PROJ).asc -p pinmap.pcf $(BUILD)/$(PROJ).blif
|
|
# Convert to bitstream using IcePack
|
|
icepack $(BUILD)/$(PROJ).asc $(BUILD)/$(PROJ).bin
|
|
|
|
# Convert bin file to hex C array
|
|
xxd -i $(BUILD)/$(PROJ).bin fpga_bin.h
|
|
echo "const $$(cat fpga_bin.h)" > fpga_bin.h
|
|
mv fpga_bin.h ../Core/Inc/User/fpga_bin.h
|
|
|
|
burn:
|
|
iceprog $(BUILD)/$(PROJ).bin
|
|
|
|
clean:
|
|
rm build/*
|
|
|
|
hex:
|
|
xxd -i $(BUILD)/$(PROJ).bin fpga_bin.h
|
|
echo "const $$(cat fpga_bin.h)" > fpga_bin.h
|
|
mv fpga_bin.h ../Core/Inc/User/fpga_bin.h
|