Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .devcontainer/openfpgatoolchain/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Image used in the pipeline of prjxray
FROM ubuntu:focal

# Make will not work for prjxray unless this env is set
ENV ALLOW_ROOT=true

# prjxray dependencies
RUN DEBIAN_FRONTEND=noninteractive apt update -qq

RUN DEBIAN_FRONTEND=noninteractive apt install -qq -y \
bash \
bison \
build-essential \
ca-certificates \
clang-format \
cmake \
colordiff \
coreutils \
flex \
git \
pypy3 \
iproute2 \
iputils-ping \
libtinfo5 \
netcat-openbsd \
psmisc \
python3 \
python3-dev \
python3-venv \
xsltproc \
sudo \
bash bison build-essential ca-certificates clang-format cmake psmisc \
colordiff coreutils git flex python3 python3-dev python3-venv xsltproc libtinfo5 libboost-all-dev libeigen3-dev \
gzip \
libftdi1-2 \
libftdi1-dev \
libhidapi-hidraw0 \
libhidapi-dev \
libudev-dev \
zlib1g-dev \
cmake \
pkg-config \
make \
g++ \
udev


# Open synthesys suite
RUN DEBIAN_FRONTEND=noninteractive apt install -qq -y yosys
# Open place-n-route tool (fork for xillinx devices)
RUN git clone https://github.com/gatecat/nextpnr-xilinx /root/nextpnr-xillinx
# Open chipdb generation tool
RUN git clone https://github.com/f4pga/prjxray /root/prjxray
# Open fpga flashing tool
RUN git clone https://github.com/trabucayre/openFPGALoader /root/openFPGALoader

WORKDIR /root/prjxray
RUN git submodule update --init --recursive
RUN make build -j$(nproc)
RUN sed -i '/# Vivado v2017\.2 (64-bit)/c return' utils/environment.sh
RUN make env
RUN ./download-latest-db.sh

WORKDIR /root/nextpnr-xillinx
RUN git submodule update --init --recursive

RUN cmake -DARCH=xilinx .
RUN make -j$(nproc)
RUN cp nextpnr-xilinx /usr/bin/

# Build chipdb for xc7a100t-1csg324
RUN pypy3 xilinx/python/bbaexport.py --device xc7a100tcsg324-1 --bba xilinx/xc7a100t.bba
RUN mkdir /root/chipdb && ./bba/bbasm --l xilinx/xc7a100t.bba /root/chipdb/xc7a100t.bin


WORKDIR /root/openFPGALoader
RUN mkdir build
WORKDIR build
RUN cmake ..
RUN cmake --build .

RUN make install
WORKDIR ..
RUN cp 99-openfpgaloader.rules /etc/udev/rules.d/
# RUN udevadm control --reload-rules && sudo udevadm trigger
ENV XRAY_DIR=/root/prjxray


WORKDIR /work
COPY entry.sh /entry.sh
RUN chmod +x /entry.sh
ENTRYPOINT ["/entry.sh"]
35 changes: 35 additions & 0 deletions .devcontainer/openfpgatoolchain/Dockerfile.alp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM alpine:latest

RUN apk add --no-cache \
bash \
bison \
build-base \
ca-certificates \
clang-extra-tools \
cmake \
colordiff \
coreutils \
flex \
git \
iproute2 \
iputils \
ncurses-libs \
netcat-openbsd \
psmisc \
python3 \
python3-dev \
libxslt \
sudo \
boost-dev \
eigen-dev

RUN apk add build-base openssl-dev zlib-dev bzip2-dev readline-dev sqlite-dev \
libffi-dev ncurses-dev xz-dev
RUN curl https://pyenv.run | sh

RUN git clone https://github.com/f4pga/prjxray /root/prjxray
WORKDIR /root/prjxray
RUN git submodule update --init --recursive
ENV ALLOW_ROOT=true
RUN make build -j$(nproc)
RUN make env
8 changes: 8 additions & 0 deletions .devcontainer/openfpgatoolchain/entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
yosys -p "synth_xilinx -flatten -nowidelut -arch xc7 -top $TOP; write_json $TOP.json" $(echo *.v)
/usr/bin/nextpnr-xilinx --chipdb /root/chipdb/xc7a100t.bin --xdc $TOP.xdc --json $TOP.json --write "${TOP}_routed.json" --fasm $TOP.fasm

source "${XRAY_DIR}/utils/environment.sh"

"${XRAY_UTILS_DIR}/fasm2frames.py" --db-root "${XRAY_DATABASE_DIR}/artix7" --part xc7a100tcsg324-1 $TOP.fasm > $TOP.frames
"${XRAY_TOOLS_DIR}/xc7frames2bit" --part_file "${XRAY_DATABASE_DIR}/artix7/xc7a100tcsg324-1/part.yaml" --part_name xc7a100tcsg324-1 --frm_file $TOP.frames --output_file $TOP.bit
7 changes: 7 additions & 0 deletions synth_and_flash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
filename=$(basename -- "$1")
TOP="${filename%.*}"
CWD=$(dirname -- "$1")
cd $CWD
docker run -it -v .:/work openfpgatoolchain $TOP
openFPGALoader -b arty_a7_100t $TOP.bit