From bcc2656f241c40714e62b37f55e222fee9dab976 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Tue, 14 Oct 2025 03:15:46 -0700 Subject: [PATCH] build devices xc7a35tcsg324-1 and xc7a100tcsg324-1 --- .containerignore | 2 ++ Containerfile | 3 +++ bbaexport_all.sh | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100755 bbaexport_all.sh diff --git a/.containerignore b/.containerignore index d23dc44..1b70da4 100644 --- a/.containerignore +++ b/.containerignore @@ -1,2 +1,4 @@ # SPDX-License-Identifier: LGPL-3.0-or-later # See Notices.txt for copyright information +* +!/bbaexport_all.sh \ No newline at end of file diff --git a/Containerfile b/Containerfile index af4eed2..5e96ddb 100644 --- a/Containerfile +++ b/Containerfile @@ -78,6 +78,8 @@ RUN git clone https://github.com/chipsalliance/f4pga-xc-fasm.git /build/f4pga-xc && pip install . \ && rm -rf /build ~/.cache +COPY bbaexport_all.sh /build/bbaexport_all.sh + RUN git clone https://github.com/openXC7/nextpnr-xilinx.git /build/nextpnr-xilinx \ && cd /build/nextpnr-xilinx \ && git checkout 724db28b41e68568690a5ea1dd9ce5082362bb91 \ @@ -88,6 +90,7 @@ RUN git clone https://github.com/openXC7/nextpnr-xilinx.git /build/nextpnr-xilin && make -j$(nproc) \ && make install \ && install bbasm /usr/local/bin/ \ + && /build/bbaexport_all.sh /opt/fayalite-deps/prjxray-db /build/nextpnr-xilinx /opt/fayalite-deps/nextpnr-xilinx xc7a35tcsg324-1 xc7a100tcsg324-1 \ && rm -rf /build RUN mkdir -p /build \ diff --git a/bbaexport_all.sh b/bbaexport_all.sh new file mode 100755 index 0000000..3d02945 --- /dev/null +++ b/bbaexport_all.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# SPDX-License-Identifier: LGPL-3.0-or-later +# See Notices.txt for copyright information + +set -e + +function usage() +{ + echo "usage: $0 ..." + echo + echo "example: $0 /opt/fayalite-deps/prjxray-db /build/nextpnr-xilinx /opt/fayalite-deps/nextpnr-xilinx xc7a35tcsg324-1 xc7a100tcsg324-1" +} + +case "$*" in + -h*|--help*) + usage + exit + ;; + "") + usage >&2 + exit 1 + ;; +esac + +prjxray_db_path="$1" +nextpnr_xilinx_source_path="$2" +nextpnr_xilinx_output_path="$3" + +if [[ ! ( -d "$prjxray_db_path" && -d "$nextpnr_xilinx_source_path" && ( ! -e "$nextpnr_xilinx_output_path" || -d "$nextpnr_xilinx_output_path" ) ) ]]; then + echo "invalid/nonexistent paths $prjxray_db_path $nextpnr_xilinx_source_path" >&2 + usage >&2 + exit 1 +elif ! python3 --version > /dev/null; then + echo "can't run python3" >&2 + usage >&2 + exit 1 +elif ! bbasm --help > /dev/null; then + echo "can't run bbasm" >&2 + usage >&2 + exit 1 +fi + +mkdir -p "$nextpnr_xilinx_output_path/xilinx" + +cd "$nextpnr_xilinx_source_path" + +for device in "${@:4}"; do + [[ "$device" =~ ^('xc7'[aksz][0-9]+'t'?)[^t0-9/].*$ ]] || { echo "invalid device: $device" >&2; exit 1; } + xray_device="${BASH_REMATCH[1]}" + python3 "$nextpnr_xilinx_source_path/xilinx/python/bbaexport.py" --device "$device" --bba "$nextpnr_xilinx_output_path/xilinx/$xray_device.bba" + bbasm --l "$nextpnr_xilinx_output_path/xilinx/$xray_device.bba" "$nextpnr_xilinx_output_path/xilinx/$xray_device.bin" + echo "finished $device" +done