Fix correct commit hash for release 0.7.0 of openXC7
[dev-env-setup.git] / nextpnr-xilinx-install
index 1b5d08580712f6b4bff74b8c2109cb77a5bd61f9..6347b6f4e151d5d1cf118578cc6b82b21b2bf824 100755 (executable)
@@ -4,65 +4,45 @@ if [ "$EUID" -ne 0 ]
   exit
 fi
 
-#!!! buster backports is needed for cmake
-cat << EOF > /etc/apt/sources.list.d/buster_backports.list
-deb http://deb.debian.org/debian buster-backports main
-EOF
-
-# oooo annoying, pin preferences for buster-backports
-cat << EOF > /etc/apt/preferences.d/99buster-backports
-Package: *
-Pin: release a=buster-backports
-Pin-Priority: 900
-EOF
-
-# upgrade to buster-backports
-apt-get update -y
-apt-get upgrade -y
-
 # change into $SUDO_USER home directory
 cd /home/$SUDO_USER
 mkdir -p src/nextpnr-xilinx
 cd src/nextpnr-xilinx
 
-apt-get install -y --allow-downgrades libcurl3-gnutls/buster git/buster git-man/buster
+apt-get install -y libcurl3-gnutls git git-man
 
-git clone https://github.com/YosysHQ/yosys.git
-git clone https://github.com/YosysHQ/abc.git
 git clone https://github.com/f4pga/prjxray.git
 git clone https://github.com/SymbiFlow/prjxray-db.git
-git clone https://github.com/gatecat/nextpnr-xilinx.git
+# switch to the nextpnr-xilinx source provided by the openXC7 project
+# it seems more stable than upstream, for now
+# See: https://bugs.libre-soc.org/show_bug.cgi?id=1004#c13
+git clone https://github.com/openXC7/nextpnr-xilinx.git
 
-## Steps to compile Yosys
+## Steps to compile prjxray
 
 ### Necessary software to install
 
-apt-get install -y build-essential make g++ cmake bison flex python3 \
- clang libreadline-dev gawk tcl-dev libffi-dev pkg-config zlib1g-dev \
- libboost-system-dev libboost-python-dev libboost-filesystem-dev
-
-### Build Yosys
+apt-get install -y build-essential make cmake python3 python3-setuptools \
+                   python3-dev python3-numpy cython3 python3-pip
 
-cd abc
-git checkout 00b674d5b3ccefc7f2abcbf5b650fc14298ac549
-cd ../yosys
-git checkout 6318db6152d053244adb316fda6e01a32a4f3c72
-ln -s ../abc .
-make -j $(nproc) PREFIX=/usr/local/nextpnr-xilinx
-make PREFIX=/usr/local/nextpnr-xilinx install
-export PATH=/usr/local/nextpnr-xilinx/bin:$PATH
-cd ..
-
-## Steps to compile prjxray
+pip3 install textx sortedcontainers
 
-### Necessary software to install
+# this really doesn't work properly, antlr is still not correctly
+# detected, (missing ANTLRconfig.cmake) but at least fasm falls back
+# to the python version
+sudo apt install -y cmake default-jre-headless uuid-dev libantlr4-runtime-dev
 
-apt-get install -y python3-pip
+apt-get install -y wget
+wget https://files.pythonhosted.org/packages/78/4c/94fb3bdb87bea21406c0e5da375f0b10d7b1e4b5103cea453a2de23b5d61/fasm-0.0.2.post88.tar.gz
+tar -xvzf fasm-0.0.2.post88.tar.gz
+cd fasm-0.0.2.post88
+python3 setup.py install
+cd ..
 
 ### Build prjxray
 
 cd prjxray
-git checkout 18b92012afe2b03f3f975a78c4372c74b60dca0c
+git checkout 76401bd93e493fd5ff4c2af4751d12105b0f4f6d
 git submodule update --init --recursive
 mkdir build; cd build
 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nextpnr-xilinx ..
@@ -74,7 +54,7 @@ install -m 0755 tools/{bitread,bittool,frame_address_decoder,gen_part_base_yaml,
 cd ..
 cp -dpr utils /usr/local/nextpnr-xilinx
 sed -i -e '/^# Vivado /,$d' /usr/local/nextpnr-xilinx/utils/environment.sh
-pip3 install .
+python3 setup.py develop
 cd ..
 
 ## Steps to compile prjxray-db
@@ -92,24 +72,36 @@ cd ..
 ### Necessary software to install
 
 apt-get install -y libboost-thread-dev libboost-iostreams-dev \
- libboost-program-options-dev libeigen3-dev
+ libboost-program-options-dev libeigen3-dev libboost-python-dev \
+ libboost-filesystem-dev
 
-### Build nextpnr-xilinx
+### Build nextpnr-xilinx from release 0.7.0 of openXC7
 
 cd nextpnr-xilinx
-git checkout 565588a69ea95a52f7c7592f4ed81d9bef6cfb60
+git checkout 14c62813ba93258143c2551f4beb0b7e044c5912
 git submodule init
 git submodule update
 cmake -DARCH=xilinx -DBUILD_GUI=OFF \
        -DCMAKE_INSTALL_PREFIX=/usr/local/nextpnr-xilinx .
 make -j$(nproc)
 make install
+
+# Generate database for fabric: XC7A100T
 ln -s xc7a100tcsg324-1 xilinx/external/prjxray-db/artix7/xc7a100t
 python3 xilinx/python/bbaexport.py --device xc7a100tcsg324-1 \
  --bba xilinx/xc7a100t.bba
 ./bbasm --l xilinx/xc7a100t.bba xilinx/xc7a100t.bin
+
+# Generate database for fabric: XC7A200T
+ln -s xc7a200tsbg484-1 xilinx/external/prjxray-db/artix7/xc7a200t
+python3 xilinx/python/bbaexport.py --device xc7a200tsbg484-1 \
+ --bba xilinx/xc7a200t.bba
+./bbasm --l xilinx/xc7a200t.bba xilinx/xc7a200t.bin
+
 install -d -m 0755 /usr/local/nextpnr-xilinx/share/xilinx
 install -m 0755 xilinx/xc7a100t.bin /usr/local/nextpnr-xilinx/share/xilinx
+install -m 0755 xilinx/xc7a200t.bin /usr/local/nextpnr-xilinx/share/xilinx
+
 export XRAY_DIR=/usr/local/nextpnr-xilinx
 cd ..