-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generalize blinky Makefile, align with other examples
- Loading branch information
Showing
2 changed files
with
30 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/*.zip | ||
/*.bin | ||
/*.bit | ||
/*.fasm | ||
/*.frames | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,47 @@ | ||
DB_DIR=${PREFIX}/share/nextpnr/external/prjxray-db | ||
|
||
PART = xc7a50tfgg484-1 | ||
ARCH:=artix7 | ||
BOARD:=arty | ||
PART:=xc7a50tfgg484-1 | ||
PROJECT:=blinky | ||
|
||
ZIP_FILE:=$(PROJECT)-bitstream.zip | ||
BIT_FILE:=$(PROJECT).bit | ||
CHIPDB:=$(PWD) | ||
|
||
.PHONY: all | ||
all: blinky.bit | ||
all: $(ZIP_FILE) | ||
|
||
.PHONY: program | ||
program: blinky.bit | ||
openFPGALoader --board arty --bitstream $< | ||
program: $(PROJECT).bit | ||
openFPGALoader --board $(BOARD) --bitstream $< | ||
|
||
$(ZIP_FILE): $(BIT_FILE) | ||
zip -j9 $@ $^ | ||
|
||
blinky.json: blinky.v | ||
yosys -p "synth_xilinx -flatten -abc9 -nobram -arch xc7 -top blinky; write_json blinky.json" $< | ||
$(PROJECT).json: $(PROJECT).v | ||
yosys -p "synth_xilinx -flatten -abc9 -nobram -arch xc7 -top $(PROJECT); write_json $@" $< | ||
|
||
# The chip database only needs to be generated once | ||
# that is why we don't clean it with make clean | ||
${CHIPDB}/${PART}.bin: | ||
pypy3 $(PREFIX)/share/nextpnr/python/bbaexport.py --device ${PART} --bba ${PART}.bba | ||
bbasm -l ${PART}.bba ${CHIPDB}/${PART}.bin | ||
bbasm -l ${PART}.bba $@ | ||
rm -f ${PART}.bba | ||
|
||
blinky.fasm: blinky.json ${CHIPDB}/${PART}.bin | ||
nextpnr-xilinx --chipdb ${CHIPDB}/${PART}.bin --xdc blinky.xdc --json blinky.json --fasm $@ --verbose --debug | ||
$(PROJECT).fasm: $(PROJECT).json ${CHIPDB}/${PART}.bin $(PROJECT).xdc | ||
nextpnr-xilinx --chipdb ${CHIPDB}/${PART}.bin --xdc $(PROJECT).xdc --json $< --fasm $@ --verbose --debug | ||
|
||
blinky.frames: blinky.fasm | ||
fasm2frames --part ${PART} --db-root ${DB_DIR}/artix7 $< > $@ | ||
$(PROJECT).frames: $(PROJECT).fasm | ||
fasm2frames --part ${PART} --db-root ${DB_DIR}/$(ARCH) $< > $@ | ||
|
||
blinky.bit: blinky.frames | ||
xc7frames2bit --part_file ${DB_DIR}/artix7/${PART}/part.yaml --part_name ${PART} --frm_file $< --output_file $@ | ||
$(BIT_FILE): $(PROJECT).frames | ||
xc7frames2bit --part_file ${DB_DIR}/$(ARCH)/${PART}/part.yaml --part_name ${PART} --frm_file $< --output_file $@ | ||
|
||
.PHONY: clean | ||
clean: | ||
@rm -f *.bit | ||
@rm -f *.frames | ||
@rm -f *.fasm | ||
@rm -f *.json | ||
@rm -f $(ZIP_FILE) $(PROJECT).bit $(PROJECT).frames $(PROJECT).fasm $(PROJECT).json | ||
|
||
.PHONY: clean_all | ||
clean_all: clean | ||
@rm -f ${CHIPDB}/${PART}.bin |