fix: Rebuild docker image using newer versions and add a Makefile.
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
abc.history
|
||||||
@@ -2,10 +2,10 @@ FROM alpine:edge AS builder
|
|||||||
|
|
||||||
# Update databases
|
# Update databases
|
||||||
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
||||||
apk update
|
apk update --no-cache
|
||||||
|
|
||||||
# Download base dependencies
|
# Download base dependencies
|
||||||
RUN apk add \
|
RUN apk add --no-cache \
|
||||||
git \
|
git \
|
||||||
make \
|
make \
|
||||||
cmake \
|
cmake \
|
||||||
@@ -24,10 +24,11 @@ RUN apk add \
|
|||||||
cython \
|
cython \
|
||||||
py3-yaml \
|
py3-yaml \
|
||||||
py3-simplejson \
|
py3-simplejson \
|
||||||
py3-intervaltree
|
py3-intervaltree \
|
||||||
|
libunwind-dev
|
||||||
|
|
||||||
# Install yosys
|
# Install yosys
|
||||||
RUN apk add yosys
|
RUN apk add --no-cache yosys
|
||||||
|
|
||||||
WORKDIR /home/root/aur-install
|
WORKDIR /home/root/aur-install
|
||||||
|
|
||||||
@@ -99,8 +100,8 @@ FROM alpine:edge
|
|||||||
|
|
||||||
# Install dependencies available in apk
|
# Install dependencies available in apk
|
||||||
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
||||||
apk update && \
|
apk update --no-cache && \
|
||||||
apk add abc py3-yaml py3-simplejson py3-intervaltree py3-arpeggio openfpgaloader
|
apk add --no-cache abc py3-yaml py3-simplejson py3-intervaltree py3-arpeggio openfpgaloader
|
||||||
|
|
||||||
# Get dependencies back
|
# Get dependencies back
|
||||||
COPY --from=builder /dependencies /
|
COPY --from=builder /dependencies /
|
||||||
@@ -112,9 +113,10 @@ COPY --from=builder /home/root/aur-install/nextpnr/build/share /usr/share/nextpn
|
|||||||
COPY --from=builder /usr/share/xray/database/zynq7 /usr/share/xray/database/zynq7
|
COPY --from=builder /usr/share/xray/database/zynq7 /usr/share/xray/database/zynq7
|
||||||
|
|
||||||
# These 3 python dependencies were built in the previous image
|
# These 3 python dependencies were built in the previous image
|
||||||
COPY --from=builder /usr/lib/python3.12/site-packages/prjxray /usr/lib/python3.12/site-packages/prjxray
|
# COPY --from=builder /usr/lib/python3.14/site-packages/prjxray /usr/lib/python3.14/site-packages/prjxray
|
||||||
COPY --from=builder /usr/lib/python3.12/site-packages/fasm /usr/lib/python3.12/site-packages/fasm
|
# COPY --from=builder /usr/lib/python3.14/site-packages/fasm /usr/lib/python3.14/site-packages/fasm
|
||||||
COPY --from=builder /usr/lib/python3.12/site-packages/textx /usr/lib/python3.12/site-packages/textx
|
# COPY --from=builder /usr/lib/python3.14/site-packages/textx /usr/lib/python3.14/site-packages/textx
|
||||||
|
COPY --from=builder /usr/lib/python3.14/site-packages /usr/lib/python3.14/site-packages/
|
||||||
|
|
||||||
WORKDIR /root/code
|
WORKDIR /root/code
|
||||||
|
|
||||||
|
|||||||
49
Makefile
Normal file
49
Makefile
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
PODMAN_RUN=podman run --mount=type=bind,source=.,target=/root/code
|
||||||
|
PODMAN_IMAGE=localhost/fmn-toolchain
|
||||||
|
PODMAN=$(PODMAN_RUN) $(PODMAN_IMAGE)
|
||||||
|
BUILD=build
|
||||||
|
|
||||||
|
create-image:
|
||||||
|
podman build -t fmn-toolchain .
|
||||||
|
|
||||||
|
run:
|
||||||
|
podman run --rm localhost/fmn-toolchain
|
||||||
|
|
||||||
|
CONSTRAINTS=example/adder.xdc
|
||||||
|
SYSTEM_VERILOG=$(shell find example -name "*.sv")
|
||||||
|
VERILOG=$(shell find example -name "*.v")
|
||||||
|
SOURCES=$(patsubst %,$(BUILD)/%,$(VERILOG)) $(patsubst %.sv,$(BUILD)/%.v,$(SYSTEM_VERILOG))
|
||||||
|
|
||||||
|
$(BUILD):
|
||||||
|
mkdir -p $(BUILD)
|
||||||
|
|
||||||
|
$(BUILD)/%.v: %.sv
|
||||||
|
mkdir -p $(dir $@)
|
||||||
|
$(PODMAN) sv2v $^ -w $@
|
||||||
|
|
||||||
|
$(BUILD)/%.v: %.v
|
||||||
|
mkdir -p $(dir $@)
|
||||||
|
cp $^ $@
|
||||||
|
|
||||||
|
$(BUILD)/synthesis.json: $(SOURCES)
|
||||||
|
$(PODMAN) yosys $^ -p "synth_xilinx; write_json $@"
|
||||||
|
|
||||||
|
$(BUILD)/out.fasm: $(BUILD)/synthesis.json
|
||||||
|
$(PODMAN) nextpnr-himbaechel --json $(filter %.json,$^) -o xdc=$(CONSTRAINTS) -o fasm=$@ --device xc7z010clg400-1
|
||||||
|
|
||||||
|
$(BUILD)/out.frames: $(BUILD)/out.fasm
|
||||||
|
$(PODMAN) fasm2frames --part xc7z010clg400-1 --db-root /usr/share/xray/database/zynq7 $^ $@
|
||||||
|
|
||||||
|
$(BUILD)/out.bin: $(BUILD)/out.frames
|
||||||
|
$(PODMAN) xc7frames2bit -frm_file $^ -part_file /usr/share/xray/database/zynq7/xc7z010clg400-1/part.yaml --output_file $@
|
||||||
|
|
||||||
|
bitstream: $(BUILD) $(BUILD)/out.bin
|
||||||
|
|
||||||
|
flash: bitstream
|
||||||
|
$(eval USB = $(shell lsusb -d 0403:6010 | sed -E "s/Bus ([0-9]{3}) Device ([0-9]{3}).*/\/dev\/bus\/usb\/\1\/\2/g"))
|
||||||
|
@if [ "$(USB)" = "" ]; then \
|
||||||
|
echo "No USB device found !"; \
|
||||||
|
else \
|
||||||
|
$(PODMAN_RUN) --device=$(USB) \
|
||||||
|
$(PODMAN_IMAGE) openFPGALoader -b zybo_z7_10 $(BUILD)/out.bin; \
|
||||||
|
fi
|
||||||
@@ -7,7 +7,7 @@ This directory shows how to flash a SystemVerilog program (a full-adder) on a Zy
|
|||||||
Firstly, the SystemVerilog file needs to be converted to verilog to use it with Yosys :
|
Firstly, the SystemVerilog file needs to be converted to verilog to use it with Yosys :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
podman run --mount=type=bind,source=.,target=/root/code fmn_alpine sv2v adder.sv -w adder.v
|
podman run --mount=type=bind,source=.,target=/root/code localhost/fmn-toolchain sv2v adder.sv -w adder.v
|
||||||
```
|
```
|
||||||
|
|
||||||
The mount parameter is used to provide the current directory to podman.
|
The mount parameter is used to provide the current directory to podman.
|
||||||
@@ -15,20 +15,20 @@ The mount parameter is used to provide the current directory to podman.
|
|||||||
Then, Yosys can perform the RTL synthesis of the program :
|
Then, Yosys can perform the RTL synthesis of the program :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
podman run --mount=type=bind,source=.,target=/root/code fmn_alpine yosys adder.v -p "synth_xilinx; write_json synthesis.json"
|
podman run --mount=type=bind,source=.,target=/root/code localhost/fmn-toolchain yosys adder.v -p "synth_xilinx; write_json synthesis.json"
|
||||||
```
|
```
|
||||||
|
|
||||||
Nextpnr can now place and route each component using the XDC constraints file :
|
Nextpnr can now place and route each component using the XDC constraints file :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
podman run --mount=type=bind,source=.,target=/root/code fmn_alpine nextpnr-himbaechel --json synthesis.json -o xdc=adder.xdc -o fasm=out.fasm --device xc7z010clg400-1
|
podman run --mount=type=bind,source=.,target=/root/code localhost/fmn-toolchain nextpnr-himbaechel --json synthesis.json -o xdc=adder.xdc -o fasm=out.fasm --device xc7z010clg400-1
|
||||||
```
|
```
|
||||||
|
|
||||||
Now the FASM file can be converted to a frames file and then to a bitstream :
|
Now the FASM file can be converted to a frames file and then to a bitstream :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
podman run --mount=type=bind,source=.,target=/root/code fmn_alpine fasm2frames --part xc7z010clg400-1 --db-root /usr/share/xray/database/zynq7 out.fasm out.frames
|
podman run --mount=type=bind,source=.,target=/root/code localhost/fmn-toolchain fasm2frames --part xc7z010clg400-1 --db-root /usr/share/xray/database/zynq7 out.fasm out.frames
|
||||||
podman run --mount=type=bind,source=.,target=/root/code fmn_alpine xc7frames2bit -frm_file out.frames -part_file /usr/share/xray/database/zynq7/xc7z010clg400-1/part.yaml --output_file out.bin
|
podman run --mount=type=bind,source=.,target=/root/code localhost/fmn-toolchain xc7frames2bit -frm_file out.frames -part_file /usr/share/xray/database/zynq7/xc7z010clg400-1/part.yaml --output_file out.bin
|
||||||
```
|
```
|
||||||
|
|
||||||
## Flashing the FPGA
|
## Flashing the FPGA
|
||||||
@@ -44,5 +44,5 @@ Bus 003 Device 005: ID 0403:6010 Future Technology Devices International, Ltd FT
|
|||||||
Here the usb device path is `/dev/bus/usb/003/005`
|
Here the usb device path is `/dev/bus/usb/003/005`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
podman run --device=/dev/bus/usb/003/005 --mount=type=bind,source=.,target=/root/code fmn_alpine openFPGALoader -b zybo_z7_10 out.bin
|
podman run --device=/dev/bus/usb/003/005 --mount=type=bind,source=.,target=/root/code localhost/fmn-toolchain openFPGALoader -b zybo_z7_10 out.bin
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user