ice40k-toolchain: New script for installing icestorm, nextpnr, tinyprog. For small...
authorAndrey Miroshnikov <andrey@technepisteme.xyz>
Fri, 7 Jul 2023 17:27:54 +0000 (17:27 +0000)
committerAndrey Miroshnikov <andrey@technepisteme.xyz>
Fri, 7 Jul 2023 17:27:54 +0000 (17:27 +0000)
ice40k-toolchain [new file with mode: 0755]

diff --git a/ice40k-toolchain b/ice40k-toolchain
new file mode 100755 (executable)
index 0000000..e47cd96
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/bash
+if [ "$EUID" -ne 0 ]
+  then echo "Please run as root using 'sudo bash'"
+  exit
+fi
+
+# Make sure to install the following first:
+# install-hdl-apt-req
+# hdl-dev-repos
+# hdl-tools-yosys
+
+# change into $SUDO_USER home directory
+cd /home/$SUDO_USER
+mkdir -p src/ice40k
+cd src/ice40k
+
+apt install libeigen3-dev libboost-filesystem-dev libboost-system-dev \
+                       libboost-thread-dev libboost-iostreams-dev
+
+git clone https://github.com/YosysHQ/icestorm.git icestorm
+git clone --recursive https://github.com/YosysHQ/nextpnr
+
+## Project icestorm
+cd icestorm
+make -j$(nproc)
+make install
+
+## Project nextpnr
+cd ../nextpnr
+# Latest tag
+git checkout nextpnr-0.6
+cmake -DARCH=ice40 -DCMAKE_INSTALL_PREFIX=/usr/local .
+make -j$(nproc)
+make install
+
+# tinyprog for programming FPGA
+pip3 install tinyprog
+
+cd /home/$SUDO_USER/src/ice40k
+chown -R $SUDO_USER .
+chgrp -R $SUDO_USER .
+