diff --git a/Dockerfile b/Dockerfile index a251b86..b10e9ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,15 @@ FROM ubuntu:19.10 MAINTAINER kost - https://github.com/kost -ENV PATH=/opt/riscv/bin:/opt/ulx3s/bin:$PATH \ +ENV PATH=/opt/riscv/bin:/opt/riscvcc/bin:/opt/ulx3s/bin:$PATH \ ULX3SURL=https://github.com/alpin3/ulx3s/releases/download/v2020.10.12/ulx3s-2020.10.12-linux-x86_64.tar.gz \ RISCVTC=https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-20171231-x86_64-linux-centos6.tar.gz \ + RISCVCC=https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v8.3.0-2.2/xpack-riscv-none-embed-gcc-8.3.0-2.2-linux-x64.tar.gz \ GHDL_PREFIX=/opt/ulx3s/ghdl/lib/ghdl \ ULX3S_USER=ulx3s RUN apt-get update && \ - apt-get install git curl make software-properties-common build-essential bison flex bc wget cpio python unzip rsync -y && \ + apt-get install git curl make software-properties-common build-essential bison flex bc wget cpio python unzip rsync device-tree-compiler libtool pkg-config libusb-1.0-0-dev libyaml-dev -y && \ add-apt-repository -y ppa:openjdk-r/ppa && \ apt-get update && \ apt-get install openjdk-8-jdk -y && \ @@ -20,6 +21,8 @@ RUN apt-get update && \ apt-get install sbt -y && \ mkdir -p /opt/riscv && \ curl -L $RISCVTC | tar -xvz --strip-components=1 -C /opt/riscv -f - && \ + mkdir -p /opt/riscvcc && \ + curl -L $RISCVCC | tar -xvz --strip-components=1 -C /opt/riscvcc -f - && \ mkdir -p /opt/ulx3s && \ curl -L $ULX3SURL | tar -xvz --strip-components=1 -C /opt/ulx3s -f - && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ diff --git a/scripts/buildsmp.sh b/scripts/buildsmp.sh new file mode 100755 index 0000000..a0cd354 --- /dev/null +++ b/scripts/buildsmp.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +export CROSS_COMPILE=/opt/riscv/bin/riscv64-unknown-elf- + +if [ "x$SAXON_BRANCH" = "x" ]; then + export SAXON_BRANCH=dev-0.1 +fi +if [ "x$DIST_OUT" = "x" ]; then + export DIST_OUT=/dist/ +fi +mkdir -p $DIST_OUT +echo "[i] Started clone" + +cd $HOME && \ + mkdir Ulx3sSmp && \ + cd Ulx3sSmp && \ + git clone https://github.com/SpinalHDL/SaxonSoc.git -b $SAXON_BRANCH --recursive SaxonSoc +source SaxonSoc/bsp/radiona/ulx3s/smp/source.sh + saxon_clone && \ + echo "[i] Success clone" + +if [ "x$FPGA_SIZES" = "x" ]; then + export FPGA_SIZES=12 # 12, 25, 45 or 85 usually +fi +if [ "x$SDRAM_SIZES" = "x" ]; then + export SDRAM_SIZES=32 # 32 or 64 usually +fi + +for SDRAM_SIZE in $SDRAM_SIZES +do +for FPGA_SIZE in $FPGA_SIZES +do +if [ "x$SDRAM_SIZE" = "x" ]; then + export SDRAM_SIZE=32 # 32 or 64 usually +fi +if [ "$SDRAM_SIZE" == "32" ]; then + export SDRAM_TIMING=MT48LC16M16A2_6A_ps +fi +if [ "$SDRAM_SIZE" == "64" ]; then + export SDRAM_TIMING=AS4C32M16SB_7TCN_ps +fi +if [ "x$FPGA_SIZE" = "x" ]; then + export FPGA_SIZE=12 # 12, 25, 45 or 85 usually +fi +echo "Building $FPGA_SIZE with SDRAM $SDRAM_SIZE and $SDRAM_TIMING to $DIST_OUT" + cd $HOME && \ + saxon_standalone_compile bootloader CFLAGS_ARGS="-DSDRAM_TIMING=$SDRAM_TIMING" && \ + SDRAM_SIZE=$SDRAM_SIZE saxon_netlist && \ + FPGA_SIZE=$FPGA_SIZE saxon_bitstream && \ + cp $HOME/Ulx3sSmp/SaxonSoc/hardware/synthesis/radiona/ulx3s/smp/bin/toplevel.bit $DIST_OUT/ulx3s-saxonsoc-$FPGA_SIZE-$SDRAM_SIZE.bit && \ + saxon_opensbi && \ + cp $HOME/Ulx3sSmp/opensbi/build/platform/spinal/saxon/radiona/ulx3s/firmware/fw_jump.bin $DIST_OUT/ulx3s-saxonsoc-fwjump-$FPGA_SIZE-$SDRAM_SIZE.bin && \ + saxon_uboot && \ + cp $HOME/Ulx3sSmp/u-boot/u-boot.bin $DIST_OUT/ulx3s-saxonsoc-uboot-$FPGA_SIZE-$SDRAM_SIZE.bin && \ + saxon_standalone_compile sdramInit CFLAGS_ARGS="-DSDRAM_TIMING=$SDRAM_TIMING" && \ + echo "[i] Success bitstream" +done +done + +if [ "x$SAXON_NOBUILDROOT" = "x" ]; then + echo "[i] Started buildroot" && \ + saxon_buildroot && \ + cp $HOME/Ulx3sSmp/buildroot/output/images/dtb $DIST_OUT/ulx3s-saxonsoc.dtb && \ + cp $HOME/Ulx3sSmp/buildroot/output/images/rootfs.cpio.uboot $DIST_OUT/ulx3s-saxonsoc-rootfs.cpio.uboot && \ + cp $HOME/Ulx3sSmp/buildroot/output/images/uImage $DIST_OUT/ulx3s-saxonsoc-uImage && \ + cp $HOME/Ulx3sSmp/buildroot/output/images/rootfs.tar $DIST_OUT/ulx3s-saxonsoc-rootfs.tar && \ + saxon_openocd && \ + echo "[i] Success buildroot" +else + echo "Skipping buildroot" +fi