Build Sifive freedom in Windows 10 64bit + cygwin


(Youry) #1

Build Sifive freedom in Windows 10 64bit + cygwin

  1. Download and install JDK 1.8.192 (jdk-8u192-windows-x64.exe)
    https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

  2. Install to default direrctory c:\Program Files\Java\jdk1.8.0_192\

  3. Download and install Vivado Design Suite 2018.2 and correspondent board support files
    https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vivado-design-tools/2018-2.html

  4. Download cygwin installer
    https://www.cygwin.com/setup-x86_64.exe

  5. Run in command prompt for install base cygwin + wget
    setup-x86_64.exe -q -a x86_64 -f -O -s http://mirrors.kernel.org/sourceware/cygwin/ -R C:\cygwinW64 -l C:\temp\cygwinW64 -P wget -D -L

  6. Run cygwin
    C:\cygwinW64\Cygwin.bat

  7. Install simple package manager from
    https://github.com/transcode-open/apt-cyg
    $ wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
    $ install apt-cyg /bin
    $ apt-cyg update

  8. Install tools
    $ apt-cyg install git make

  9. Get Sifive freedom source tree from
    https://github.com/sifive/freedom
    $ cd ~
    $ git clone https://github.com/sifive/freedom.git
    $ cd ~/freedom
    $ git reset --hard 3624efff1819e52cec30c72f9085158189f8b53f
    $ git submodule update --init --recursive

  10. Replace firrtl version
    $ cd ~/freedom/rocket-chip
    $ mv firrtl firrtl-
    $ git clone https://github.com/freechipsproject/firrtl.git
    $ cd ~/freedom/rocket-chip/firrtl
    $ git reset --hard 4253791132c5c550e1bc4a8070cb54e558f17809

  11. Register Vivado and JDK path in exports
    $ cat <<END >>~/.bash_profile
    export JAVA_HOME=/cygdrive/c/Program\ Files/Java/jdk1.8.0_192/
    export PATH=\$PATH:\$JAVA_HOME/bin:/cygdrive/c/Xilinx/Vivado/2018.2/bin
    END
    $ . ~/.bash_profile

  12. Create verilog for e300artydevkit or vc707-u500devkit
    $ cd ~/freedom
    $ make -f Makefile.e300artydevkit verilog base_dir=$(cygpath -m $(pwd))
    $ make -f Makefile.vc707-u500devkit verilog base_dir=$(cygpath -m $(pwd))

  13. Install tools for build toolchain
    $ apt-cyg install gcc-core texinfo flex bison gcc-g++ libexpat-devel gettext-devel zlib-devel

  14. Build toolchain u500 for build bootloader
    $ cd ~/freedom/rocket-chip/riscv-tools
    $ FILE="build.sh" cat <<END >/tmp/$FILE
    $(grep -ivE 'openocd|riscv-fesvr|riscv-isa-sim|riscv-pk|iscv-tests' $FILE)
    END
    chmod 755 /tmp/$FILE
    RISCV=~/freedom/toolchain/u500 /tmp/$FILE

  15. Build toolchain e300 if need
    $ cd ~/freedom/rocket-chip/riscv-tools
    $ FILE="build-rv32ima.sh" cat <<END >/tmp/$FILE
    $(grep -ivE 'openocd|riscv-fesvr|riscv-isa-sim|riscv-pk|iscv-tests' $FILE)
    END
    chmod 755 /tmp/$FILE
    RISCV=~/freedom/toolchain/e300 /tmp/$FILE

  16. Build device tree compiler for cygwin
    $ cd ~/freedom
    $ wget https://git.kernel.org/pub/scm/utils/dtc/dtc.git/snapshot/dtc-1.4.7.tar.gz
    $ tar xzf dtc-1.4.7.tar.gz & cd dtc-1.4.7
    $ HOME=/usr make install

  17. Build bitstream & hex objects wth Vivado
    $ cd ~/freedom
    $ RISCV=~/freedom/toolchain/u500 make -f Makefile.vc707-u500devkit mcs base_dir=$(cygpath -m $(pwd))
    $ RISCV=~/freedom/toolchain/u500 make -f Makefile.e300artydevkit mcs base_dir=$(cygpath -m $(pwd))

Enjoy!
Certainly has also more simple way on Windows 10 is use WSL + ubuntu :wink: