From 12bfa457b45031d9ed139826a2341094223c3262 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Sat, 17 Aug 2019 22:06:39 +0800 Subject: [PATCH] initial commit Signed-off-by: Sean Cross --- .gitattributes | 12 ++++ .gitignore | 3 + .travis.yml | 30 ++++++++++ README.md | 14 +++++ build.sh | 149 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 208 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 README.md create mode 100644 build.sh diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..cf317d0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,12 @@ +*.py text eol=lf +*.dfu binary +*.png binary +*.jpg binary +*.bin binary +*.elf binary +*.h text eol=lf +*.c text eol=lf +README.* text eol=lf +LICENSE text eol=lf +Makefile text eol=lf +*.mk text eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8e1c740 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +fomu-toolchain-* +input/ +.vscode/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..772b28a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +language: minimal +matrix: + include: + - env: ARCH=windows + - env: ARCH=macos + - env: ARCH=linux_x86_64 +addons: + apt: + packages: + - unzip + - zip +install: skip +script: ./build.sh +deploy: + provider: releases + api_key: + secure: XQT7uml8NgeV21l8fjJkcRxN+MjN1RZoI3uoLd+c9dKqLT3KPRx2qsVkq2PyuWnMLGJfnYEeguocq7nDPKYLbXEhG9Q5t+C7pKDKFwwhKkIvjBESN6e1qzVrRfKgCyQltO1F4+xQ39ks8sxAWl2oGF5ag9JoG0HN3SCKsFvQtWb05DYU3ijIGyUdDsx2IMZZW6N2RguF4iiFzgzP062YDiz1e0rJ9JcOWRkmt6D/2srur2pay5xl9+x8F8QjWdBwk4O/JldavRo0PQhT0osvr8MDqdG9Ad+/9116OWeOO4a0kIj1RwIhcRmgvbjTX2HAU5UW9IPP4IgZp2fT5TQ4Wc6c3ov7UU0o/hXRJJBO52EbnAcqlucnKPggYfun8svvqD6efsj3wHCLr0SaGYeZ0bmehn+b5iHudHM9XNslRxqEiKwaAGpJy9Uk9ncLqNnspel288CGh9zJfXDcWH4uHlA6Dy/NU3WQ9rHifUBIScobJVVdgEfaYctPKN7kLS7SYFUr/E2EPRiBCB5DuuGngjiie73KoU6O9kyFWvpfdjV4g9BnG2MmRd2k1CBU6Qx0H1e9teWqvkLAYvibiA0VcJuhlaC14PDJgWTgIOVJG4i36DBUilvLX2bBwqnBQ+E+j3WY8Mh8kw4zNmGAzjn5jPRHSXWpfhlktYbGHOeC0K0= + file: + - output/*.tar.gz + - output/*.zip + file_glob: true + skip_cleanup: true + on: + repo: im-fomu/fomu-toolchain + all_branches: true + tags: true +branches: + only: + # Release tags + - /^v\d+\.\d+/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..1ffce6b --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# Fomu Toolchain + +Fomu is an FPGA in your USB port. This repository contains prebuilt versions of all the tools you will need to develop for Fomu. + +## Usage + +Download the [latest release](https://github.com/im-fomu/fomu-toolchain/releases/latest) for your platform and extract it somewhere on your disk. Then set your PATH: + +* MacOS: `export PATH=[path-to-bin]:$PATH` +* Linux: `export PATH=[path-to-bin]:$PATH` +* Windows Powershell: `$ENV:PATH = "[path-to-bin];" + $ENV:PATH` +* Windows cmd.exe: `PATH=[path-to-bin];%PATH` + +To confirm installation, run a command such as `nextpnr-ice40` or `yosys`. \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..fd0e5dd --- /dev/null +++ b/build.sh @@ -0,0 +1,149 @@ +#!/bin/sh -x +set -e + +win_python_url="https://www.python.org/ftp/python/3.7.3/python-3.7.3-embed-amd64.zip" +win_nextpnr_url="https://github.com/xobs/toolchain-nextpnr-ice40/releases/download/v1.25-fomu/nextpnr-windows_amd64-v1.25-fomu.zip" +win_icestorm_url="https://github.com/xobs/toolchain-icestorm/releases/download/v1.26-fomu/toolchain-icestorm-windows_amd64-v1.26-fomu.zip" +win_wishbone_tool_url="https://github.com/xobs/wishbone-utils/releases/download/v0.2.10/wishbone-tool-v0.2.10-x86_64-pc-windows-gnu.tar.gz" +win_riscv_url="https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.2.0-2019.05.3-x86_64-w64-mingw32.zip" +win_make_url="https://sourceforge.net/projects/ezwinports/files/make-4.2.1-without-guile-w32-bin.zip/download" +win_teraterm_url="https://osdn.net/frs/redir.php?m=constant&f=ttssh2%2F71232%2Fteraterm-4.103.zip" + +mac_nextpnr_url=https://github.com/xobs/toolchain-nextpnr-ice40/releases/download/v1.25-fomu/nextpnr-ice40-darwin-v1.25-fomu.tar.gz +mac_icestorm_url=https://github.com/xobs/toolchain-icestorm/releases/download/v1.26-fomu/toolchain-icestorm-darwin-v1.26-fomu.tar.gz +mac_wishbone_tool_url=https://github.com/xobs/wishbone-utils/releases/download/v0.2.10/wishbone-tool-v0.2.10-x86_64-apple-darwin.tar.gz +mac_riscv_url=https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.2.0-2019.05.3-x86_64-apple-darwin.tar.gz + +linux_nextpnr_url=https://github.com/xobs/toolchain-nextpnr-ice40/releases/download/v1.25-fomu/nextpnr-ice40-linux_x86_64-v1.25-fomu.tar.gz +linux_icestorm_url=https://github.com/xobs/toolchain-icestorm/releases/download/v1.26-fomu/toolchain-icestorm-linux_x86_64-v1.26-fomu.tar.gz +linux_wishbone_tool_url=https://github.com/xobs/wishbone-utils/releases/download/v0.2.10/wishbone-tool-v0.2.10-x86_64-unknown-linux-gnu.tar.gz +linux_riscv_url=https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.2.0-2019.05.3-x86_64-linux-centos6.tar.gz + +base="$(pwd)" +output_name="fomu-toolchain-${ARCH}-${TRAVIS_TAG}" +output="${base}/output/${output_name}" +input="${base}/input" +mkdir -p $output +mkdir -p $input +mkdir -p $output/bin + +echo "${TRAVIS_TAG}" > $output/VERSION + +case "${ARCH}" in + "windows") + # Python 3.7.3 (which matches the version in nextpnr) + wget -O $input/python-${ARCH}.zip $win_python_url + cd $output/bin + unzip -o $input/python-${ARCH}.zip + rm python37.zip # we already have this unzipped from nextpnr-ice40 + + # Nextpnr + wget -O $input/nextpnr-${ARCH}.zip $win_nextpnr_url + cd $output/bin + unzip -o $input/nextpnr-${ARCH}.zip + + # Yosys, icestorm, and dfu_util + wget -O $input/icestorm-${ARCH}.zip $win_icestorm_url + cd $output + unzip -o $input/icestorm-${ARCH}.zip + + # Teraterm Terminal + wget -O $input/teraterm-${ARCH}.zip $win_teraterm_url + cd $output/bin + unzip -o $input/teraterm-${ARCH}.zip + + # Wishbone Tool + wget -O $input/wishbone-tool-${ARCH}.tar.gz $win_wishbone_tool_url + cd $output/bin + tar xvzf $input/wishbone-tool-${ARCH}.tar.gz + + # Riscv Toolchain + # Note that we want to strip the front part of the path. + # Also, we do "cp -l" then "rm -rf" to merge the directories. + wget -O $input/riscv-${ARCH}.zip $win_riscv_url + cd $input + mkdir re + cd re + unzip -o $input/riscv-${ARCH}.zip + cp -f -l -r */* $output + cd .. + rm -rf re + + # Make.exe + wget -O $input/make-${ARCH}.zip $win_make_url + cd $output + unzip -o $input/make-${ARCH}.zip + + cd $base/output + zip -r $output_name.zip $output_name + ;; + + "macos") + # Nextpnr + wget -O $input/nextpnr-${ARCH}.tar.gz $mac_nextpnr_url + cd $output + tar xvzf $input/nextpnr-${ARCH}.tar.gz + + # Yosys, icestorm, and dfu_util + wget -O $input/icestorm-${ARCH}.tar.gz $mac_icestorm_url + cd $output + tar xvzf $input/icestorm-${ARCH}.tar.gz + + # Wishbone Tool + wget -O $input/wishbone-tool-${ARCH}.tar.gz $mac_wishbone_tool_url + cd $output/bin + tar xvzf $input/wishbone-tool-${ARCH}.tar.gz + + # Riscv Toolchain + # Note that we want to strip the front part of the path. + # Also, we do "cp -l" then "rm -rf" to merge the directories. + wget -O $input/riscv-${ARCH}.tar.gz $mac_riscv_url + cd $input + mkdir re + cd re + tar xvzf $input/riscv-${ARCH}.tar.gz + cp -f -l -r */* $output + cd .. + rm -rf re + + cd $base/output + zip -r $output_name.zip $output_name + ;; + + "linux_x86_64") + # Nextpnr + wget -O $input/nextpnr-${ARCH}.tar.gz $linux_nextpnr_url + cd $output + tar xvzf $input/nextpnr-${ARCH}.tar.gz + + # Yosys, icestorm, and dfu_util + wget -O $input/icestorm-${ARCH}.tar.gz $linux_icestorm_url + cd $output + tar xvzf $input/icestorm-${ARCH}.tar.gz + + # Wishbone Tool + wget -O $input/wishbone-tool-${ARCH}.tar.gz $linux_wishbone_tool_url + cd $output/bin + tar xvzf $input/wishbone-tool-${ARCH}.tar.gz + + # Riscv Toolchain + # Note that we want to strip the front part of the path. + # Also, we do "cp -l" then "rm -rf" to merge the directories. + wget -O $input/riscv-${ARCH}.tar.gz $linux_riscv_url + cd $input + mkdir re + cd re + tar xvzf $input/riscv-${ARCH}.tar.gz + cp -f -l -r */* $output + cd .. + rm -rf re + + cd $base/output + tar cvzf $output_name.tar.gz $output_name + ;; + *) + echo "Unrecognized architecture: ${ARCH}" + echo "Supported architectures: macos, windows, linux_x86_64" + exit 1 + ;; +esac \ No newline at end of file