Skip to content

Instantly share code, notes, and snippets.

@nihirash
Created May 31, 2021 16:33
Show Gist options
  • Select an option

  • Save nihirash/3ee42edb2ff98079f76a624efaa18ae6 to your computer and use it in GitHub Desktop.

Select an option

Save nihirash/3ee42edb2ff98079f76a624efaa18ae6 to your computer and use it in GitHub Desktop.
Makefile for Lattice ECP5
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
SOURCES=$(call rwildcard,rtl,*.v)
RESULT=hardware
TOP=top
NEXTPNRPARAMS=--25k --package CABGA256 --speed 6
LPF=icesugar_pro
all: $(RESULT).bin
$(RESULT).bin: $(RESULT).cfg
ecppack --svf ${RESULT}.svf $(RESULT).cfg $(RESULT).bin
$(RESULT).cfg: $(RESULT).json
nextpnr-ecp5 $(NEXTPNRPARAMS) --json $(RESULT).json --lpf $(LPF).lpf --textcfg $(RESULT).cfg
$(RESULT).json: $(SOURCES) $(LPF).lpf $(MEMORY_DUMPS) $(ROM).rom
yosys -p 'synth_ecp5 -top $(TOP) -json $(RESULT).json' $(SOURCES)
clean:
rm *.cfg *.svf *.bin *.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment