w
This commit is contained in:
46
Makefile
Normal file
46
Makefile
Normal file
@ -0,0 +1,46 @@
|
||||
DCK=podman
|
||||
IMAGE_NAME=gowin
|
||||
WORKDIR=.
|
||||
|
||||
DCK_VOLUMES=-v $(WORKDIR):/work
|
||||
DCK_RUN=$(DCK) run $(DCK_VOLUMES) $(IMAGE_NAME)
|
||||
DCK_RUN_IT=$(DCK) run $(DCK_VOLUMES) -it $(IMAGE_NAME)
|
||||
|
||||
RTL_DIR=RTL/
|
||||
RTL_SV=$(shell find $(RTL_DIR) -name "*.sv")
|
||||
RTL_SVV = $(patsubst %.sv,%.v,$(RTL_SV))
|
||||
RTL_SOURCE=$(RTL_SVV) $(shell find $(RTL_DIR) -name "*.v")
|
||||
|
||||
DEVICE_PATH=$(shell lsusb | grep "0403:6010" | sed -E "s/Bus ([0-9]{3}) Device ([0-9]{3}).*/\/dev\/bus\/usb\/\1\/\2/g")
|
||||
DCK_DEVICES=--device $(DEVICE_PATH)
|
||||
|
||||
.PHONY: build_image bash clean
|
||||
|
||||
## Build the container
|
||||
build_image:
|
||||
$(DCK) build -t $(IMAGE_NAME) .
|
||||
|
||||
## Get a bash shell inside the container
|
||||
bash:
|
||||
$(DCK_RUN_IT) /bin/bash
|
||||
|
||||
gw_sh:
|
||||
$(DCK_RUN_IT) gw_sh
|
||||
|
||||
impl/pnr/build.fs: $(RTL_SVV) build.tcl
|
||||
$(DCK_RUN) "RTL_FILES=\"$(shell find $(RTL_DIR) -name *.v)\" gw_sh build.tcl"
|
||||
|
||||
flash: impl/pnr/build.fs
|
||||
if [ -z "$(DEVICE_PATH)" ]; then \
|
||||
echo "Device not found."; \
|
||||
else \
|
||||
$(DCK) run --privileged --device /dev/bus/usb:/dev/bus/usb $(DCK_VOLUMES) gowin "openFPGALoader impl/pnr/build.fs"; \
|
||||
fi
|
||||
|
||||
%.v: %.sv
|
||||
$(DCK_RUN) "sv2v --write=adjacent $<"
|
||||
|
||||
clean:
|
||||
rm -rf $(RTL_SVV)
|
||||
rm -rf impl
|
||||
|
||||
Reference in New Issue
Block a user