diff --git a/.github/workflows/docker-publish-tagged-qorc-base.yml b/.github/workflows/docker-publish-tagged-qorc-base.yml new file mode 100644 index 0000000..5ad54d5 --- /dev/null +++ b/.github/workflows/docker-publish-tagged-qorc-base.yml @@ -0,0 +1,49 @@ +name: Docker + +on: + push: + tags: [ v* ] + workflow_dispatch: + +env: + IMAGE_NAME: qorc-base + +jobs: + push: + runs-on: ubuntu-latest + if: github.event_name == 'push' + + steps: + - uses: actions/checkout@v2 + + - name: Build image + run: | + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + docker build --build-arg TAG=$VERSION --target qorc-base . --file Dockerfile.use-installer --tag $IMAGE_NAME + + - name: Log into registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin + + - name: Push image + run: | + IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + + # Use Docker `latest` tag convention + [ "$VERSION" == "master" ] && VERSION=latest + + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION \ No newline at end of file diff --git a/.github/workflows/docker-publish-tagged-qorc.yml b/.github/workflows/docker-publish-tagged-qorc.yml new file mode 100644 index 0000000..2275867 --- /dev/null +++ b/.github/workflows/docker-publish-tagged-qorc.yml @@ -0,0 +1,49 @@ +name: Docker + +on: + push: + tags: [ v* ] + workflow_dispatch: + +env: + IMAGE_NAME: qorc + +jobs: + push: + runs-on: ubuntu-latest + if: github.event_name == 'push' + + steps: + - uses: actions/checkout@v2 + + - name: Build image + run: | + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + docker build --build-arg TAG=$VERSION . --file Dockerfile.use-installer --tag $IMAGE_NAME + + - name: Log into registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin + + - name: Push image + run: | + IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + + # Use Docker `latest` tag convention + [ "$VERSION" == "master" ] && VERSION=latest + + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION \ No newline at end of file diff --git a/.github/workflows/docker-publish-tagged.yml b/.github/workflows/docker-publish-tagged.yml index 1f9cc05..12bc367 100644 --- a/.github/workflows/docker-publish-tagged.yml +++ b/.github/workflows/docker-publish-tagged.yml @@ -21,7 +21,7 @@ jobs: # Strip git ref prefix from version VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - docker build --build-arg TAG=$VERSION . --file Dockerfile.use-installer --tag $IMAGE_NAME + docker build --build-arg TAG=$VERSION --target symbiflow-ql . --file Dockerfile.use-installer --tag $IMAGE_NAME - name: Log into registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index d12361a..ffb939a 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -44,4 +44,6 @@ jobs: echo VERSION=$VERSION docker tag $IMAGE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION \ No newline at end of file + docker push $IMAGE_ID:$VERSION + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile index b7a317f..a787ad8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ RUN apt-get update -qq \ git \ libffi-dev \ libreadline-dev \ + libtbb-dev \ tcl-dev \ graphviz \ wget \ @@ -40,10 +41,10 @@ RUN apt-get update -qq \ iverilog \ pkg-config -#Checkout *yosys* repository (https://github.com/QuickLogic-Corp/yosys.git), branch: **quicklogic-rebased**. +#Checkout *yosys* repository (https://github.com/QuickLogic-Corp/yosys.git), branch: **quicklogic-rebased**. RUN git clone https://github.com/QuickLogic-Corp/yosys.git -b quicklogic-rebased quicklogic-yosys -RUN cd quicklogic-yosys WORKDIR /quicklogic-yosys + RUN make config-gcc RUN make install PREFIX=${INSTALL_DIR}/install RUN cd - @@ -51,24 +52,24 @@ RUN cd - #Checkout *yosys-symbiflow-plugins* (https://github.com/QuickLogic-Corp/yosys-symbiflow-plugins), branch: **ql-ios**. WORKDIR / RUN git clone https://github.com/QuickLogic-Corp/yosys-symbiflow-plugins -b ql-ios -RUN cd yosys-symbiflow-plugins + WORKDIR /yosys-symbiflow-plugins # export PATH='specify Yosys installation path as specified in PREFIX in previous step':$PATH RUN make RUN make install RUN cd - -#Checkout *vpr* repository (https://github.com/QuickLogic-Corp/vtr-verilog-to-routing.git), branch: **blackbox_timing**. +#Checkout *vpr* repository (https://github.com/SymbiFlow/vtr-verilog-to-routing.git), branch: **master**. WORKDIR / -RUN git clone https://github.com/QuickLogic-Corp/vtr-verilog-to-routing -b blackbox_timing +RUN git clone https://github.com/SymbiFlow/vtr-verilog-to-routing -b master RUN cd vtr-verilog-to-routing WORKDIR /vtr-verilog-to-routing RUN make -#Checkout *symbiflow-arch-defs* repository (https://github.com/QuickLogic-Corp/symbiflow-arch-defs.git), branch: **quicklogic-upstream-rebase**. +#Checkout *symbiflow-arch-defs* repository (https://github.com/QuickLogic-Corp/symbiflow-arch-defs.git), branch: **quicklogic-upstream-rebase**. WORKDIR / RUN git clone https://github.com/QuickLogic-Corp/symbiflow-arch-defs.git -b quicklogic-upstream-rebase -RUN cd symbiflow-arch-defs + WORKDIR /symbiflow-arch-defs RUN make env @@ -86,6 +87,11 @@ COPY --from=build /symbiflow-arch-defs /symbiflow-arch-defs/ COPY --from=build /yosys-symbiflow-plugins /yosys-symbiflow-plugins/ COPY --from=build /vtr-verilog-to-routing /vtr-verilog-to-routing/ +# Probably should add these to the release candidate: +# ENV YOSYS='path to Yosys binary, installed in first step' +# ENV VPR='path to vpr binary built' +# ENV GENFASM='path to genfasm binary built' + FROM release-candidate AS all_quick_tests WORKDIR /symbiflow-arch-defs/build/quicklogic/pp3/tests diff --git a/Dockerfile.use-installer b/Dockerfile.use-installer index 83598f3..13c3958 100644 --- a/Dockerfile.use-installer +++ b/Dockerfile.use-installer @@ -1,13 +1,16 @@ -FROM ubuntu:20.04 as builder +FROM ubuntu:20.04 as base ARG DEBIAN_FRONTEND=noninteractive ENV TZ=America/Los_Angeles +# install depedencies that are not yet in the installer RUN apt-get update && apt-get install -y \ - libcanberra-gtk-module \ - make \ curl \ git \ + gnupg \ + libcanberra-gtk-module \ + libtbb-dev\ + make \ wget \ xz-utils && \ rm -rf /var/lib/apt/lists/* @@ -16,8 +19,16 @@ RUN apt-get update && apt-get install -y \ RUN echo "dash dash/sh boolean false" | debconf-set-selections RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash +# install bazel (needed for tensorFlow) +RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg && \ + mv bazel.gpg /etc/apt/trusted.gpg.d/ && \ + echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list && \ + apt update && apt install -y \ + bazel && \ + rm -rf /var/lib/apt/lists/* + # add ARGs so that these can be passed in while doing a docker build, the following will be default values -ARG TAG=v1.3.0 +ARG TAG=v0.0.0 ENV INSTALL_DIR="/opt/symbiflow/eos-s3" # Appending all of these commands (mostly the chmod 755 commands) saved about 1.9 GB in image size RUN wget https://github.com/QuickLogic-Corp/quicklogic-fpga-toolchain/releases/download/${TAG}/Symbiflow_${TAG}.gz.run && \ @@ -26,7 +37,192 @@ RUN wget https://github.com/QuickLogic-Corp/quicklogic-fpga-toolchain/releases/d rm Symbiflow_${TAG}.gz.run && \ chmod 755 /opt/symbiflow && \ chmod 755 /opt/symbiflow/eos-s3 && \ - chmod -R 755 /opt/symbiflow/eos-s3/conda + chmod -R 755 /opt/symbiflow/eos-s3/conda && \ + chmod -R 755 /opt/symbiflow/eos-s3/quicklogic-arch-defs ENV PATH="${INSTALL_DIR}/quicklogic-arch-defs/bin:${INSTALL_DIR}/quicklogic-arch-defs/bin/python:$PATH" +# The symbiflow-ql target is the same as in previous versions of Dockerfile.use-installer. +# It contains no user or entrypoint, which makes it easy to re-use as a parent image. +# +# Build the symbiflow-ql target with a command like this: +# docker build --build-arg TAG=v1.3.1 -f Dockerfile.use-installer --target symbiflow-ql . -t symbiflow-ql +# +# Run it with a command like this: +# docker run -it --rm -e DISPLAY=$DISPLAY -v "/tmp/.X11-unix:/tmp/.X11-unix" -v $(pwd):/root symbiflow-ql bash +# +FROM base as symbiflow-ql + +# The qorc-base target has no user and no entrypoint specified, which makes +# it useful as a base image. +# +# Build the qorc-base target with a command like this: +# docker build --build-arg TAG=v1.3.1 -f Dockerfile.use-installer --target qorc-base . -t qorc-base +# +# Run it in the qorc-sdk directory or another project directory with a command like this: +# docker run -it --rm -e DISPLAY=$DISPLAY -v "/tmp/.X11-unix:/tmp/.X11-unix" -v $(pwd):/root qorc-base bash +# +# Note that when using the qorc-base target, there is no entrypoint script so you need to source +# the conda.sh file, and activate conda before running make in qorc-sdk. +# +FROM symbiflow-ql as qorc-base + +WORKDIR /opt + +RUN wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 && \ + tar -xjvf gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 && \ + rm gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 + +ENV PATH=/opt/gcc-arm-none-eabi-9-2020-q2-update/bin:$PATH +ENV QORC_TC_PATH=/opt/gcc-arm-none-eabi-9-2020-q2-update/bin + +# The following tests are run automatically during a build of the default qorc image +FROM qorc-base as qorc-test-base + +WORKDIR / +RUN git clone --recursive https://github.com/QuickLogic-Corp/qorc-sdk.git + +FROM qorc-test-base as qorc-test-qf_apps + +WORKDIR /qorc-sdk/qf_apps +RUN source $INSTALL_DIR/conda/etc/profile.d/conda.sh && \ + conda activate && \ + make + +# The qorc-user target adds a user and entrypoint to the default target. +# Build the qorc-user target with a command like this: +# docker build --build-arg TAG=v1.3.1 -f Dockerfile.use-installer --target qorc-user . -t qorc-user +# +# Run it in the qorc-sdk directory or any project directory with a command like this: +# docker run -it --rm -e DISPLAY=$DISPLAY -v "/tmp/.X11-unix:/tmp/.X11-unix" -v $(pwd):/home/ic qorc-user bash +# +# Note that the conda-user.sh file used as an entrypoint sources the conda.sh file and activates conda +# so there is no need to do those things when using this qorc-user target. Simply run make inside qorc-sdk. +# +FROM qorc-base as qorc-user + +RUN apt-get update && apt-get install -y \ + libusb-1.0-0 \ + python3-pip \ + usbutils \ + udev && \ + rm -rf /var/lib/apt/lists/* + +ARG USER=ic +ENV USER=${USER} +ARG UID=1000 +ARG GID=1000 +RUN addgroup --gid ${GID} ${USER} +RUN adduser --uid ${UID} --gid ${GID} --gecos "" --disabled-password --shell /bin/bash ${USER} + +USER ${USER} +WORKDIR /home/${USER} + +COPY --chown=ic:ic conda-user.sh /scripts/conda-user.sh + +ENTRYPOINT [ "/scripts/conda-user.sh" ] + +# create a base layer that checks out the qorc-sdk repo containing various projects +# that may be used to test the image. We run tests using the qorc-user layer, and +# if none of them fail, that layer is tagged as the default qorc layer. +FROM qorc-user as qorc-user-test + +RUN echo $PATH +RUN git --version +RUN git clone --recursive https://github.com/QuickLogic-Corp/qorc-sdk.git + +# The following tests run automatically during a build of the default qorc target. +# If any of these tests fail, the build will not tag a qorc image. + +FROM qorc-user-test as qorc-user-test-qf-apps + +WORKDIR /home/${USER}/qorc-sdk/qf_apps +RUN source $INSTALL_DIR/conda/etc/profile.d/conda.sh && \ + conda activate && \ + make + +# One of the following qf_vr_apps wouldn't build from the main makefile, so +# building them independently for now. +FROM qorc-user-test as qorc-user-test-qf_vr_apps + +WORKDIR /home/${USER}/qorc-sdk/qf_vr_apps +RUN source $INSTALL_DIR/conda/etc/profile.d/conda.sh && \ + conda activate && \ + make 1micvr_app && \ + make 2micvr_app && \ + make vr_raw_app && \ + make host_app && \ + make vr_i2s_app && \ + make vr_opus_app && \ + make vr_raw_wifi_app && \ + make vr_aec_app +# make amazon_alexa_app +# won't link, so commented it out. + + +FROM qorc-user-test as qorc-user-test-qorc-testapps + +# The main makefile only runs 3 of these, so testing them independently +WORKDIR /home/${USER}/qorc-sdk/qorc-testapps/qf_advancedfpga_separate/GCC_Project +RUN source $INSTALL_DIR/conda/etc/profile.d/conda.sh && \ +conda activate && \ +make + +WORKDIR /home/${USER}/qorc-sdk/qorc-testapps/qf_baremetal/GCC_Project +RUN source $INSTALL_DIR/conda/etc/profile.d/conda.sh && \ +conda activate && \ +make + +WORKDIR /home/${USER}/qorc-sdk/qorc-testapps/qf_gwtestharness_fll/GCC_Project +RUN source $INSTALL_DIR/conda/etc/profile.d/conda.sh && \ +conda activate && \ +make + +WORKDIR /home/${USER}/qorc-sdk/qorc-testapps/qf_helloworldm4/GCC_Project +RUN source $INSTALL_DIR/conda/etc/profile.d/conda.sh && \ +conda activate && \ +make + +WORKDIR /home/${USER}/qorc-sdk/qorc-testapps/qf_helloworldsw_separate/GCC_Project +RUN source $INSTALL_DIR/conda/etc/profile.d/conda.sh && \ +conda activate && \ +make + +WORKDIR /home/${USER}/qorc-sdk/qorc-testapps/qf_ramblockinit/GCC_Project +RUN source $INSTALL_DIR/conda/etc/profile.d/conda.sh && \ +conda activate && \ +make + +# The qf_usbspeed app doesn't compile, so commented it out for now. +#WORKDIR /qorc-sdk/qorc-testapps/qf_usbspeed/GCC_Project +#RUN source $INSTALL_DIR/conda/etc/profile.d/conda.sh && \ +#conda activate && \ +#make + +FROM qorc-user-test as qorc-user-test-qomu-apps + +WORKDIR /home/${USER}/qorc-sdk/qomu_apps +RUN source $INSTALL_DIR/conda/etc/profile.d/conda.sh && \ +conda activate && \ +make + + +FROM qorc-user-test as qorc-user-test-qorc-example-apps + +WORKDIR /home/${USER}/qorc-sdk/qorc-example-apps/qf_pm2dot5aqi/GCC_Project +RUN source $INSTALL_DIR/conda/etc/profile.d/conda.sh && \ +conda activate && \ +make + +FROM qorc-user as qorc +# If the above test builds complete, the qorc-user becomes the default target, qorc. +# Build the default qorc target with a command like this: +# docker build --build-arg TAG=v1.3.1 -f Dockerfile.use-installer . -t qorc +# +# Run it in the qorc-sdk directory or any project directory with a command like this: +# docker run -it --rm -e DISPLAY=$DISPLAY -v "/tmp/.X11-unix:/tmp/.X11-unix" -v $(pwd):/home/ic qorc bash +# +# Note that the conda-user.sh file used as an entrypoint sources the conda.sh file and activates conda +# so there is no need to do those things when using this qorc target. Simply run make inside qorc-sdk. +# + diff --git a/README.rst b/README.rst index 1adae7c..8135129 100644 --- a/README.rst +++ b/README.rst @@ -21,9 +21,6 @@ QLF-K4N8/QLF-K6N10 Device: Below are some ways to run SymbiFlow for QLF-K4N8/QLF-K6N10 Devices: -1) Run an installer and run an example -2) Compile from source code and run example - .. _1-run-an-installer-and-run-an-example: 1) Run an installer and run an example @@ -227,6 +224,48 @@ it: cd quicklogic/pp3/tests/quicklogic_testsuite/bin2seven make bin2seven-ql-chandalar_fasm +.. _3-run-symbiflow-in-a-container: + +3) Run SymbiFlow in a container +------------------------------------------- + +The qorc-sdk project from Quicklogic's github page contains good examples for running the qorc tools to +create hardware and FPGA gateware for the quickfeather development kit. +https://github.com/QuickLogic-Corp/qorc-sdk + +A quick way to get started without installing any tools is to use a docker container. Build your own +container image from Dockerfile.use-installer with: + + :: + + docker build --build-arg TAG=v1.3.1 -f Dockerfile.use-installer . -t qorc:1.3.1 + +Or pull a prebuilt container image from github with: + + :: + + docker pull ghcr.io/thirsty2/quicklogic-fpga-toolchain/qorc:1.3.1 + docker tag ghcr.io/thirsty2/quicklogic-fpga-toolchain/qorc:1.3.1 qorc:1.3.1 + +If you have cloned the qorc-sdk project, you can use the container and build an example project. +Change to the qorc-sdk directory, and start bash in a qorc container with: + + :: + + cd qorc-sdk + docker run -it --rm -v $(pwd):/home/ic/qorc-sdk qorc:1.3.1 bash + source $INSTALL_DIR/conda/etc/profile.d/conda.sh + conda activate + cd qorc-sdk/qf_apps/qf_helloworldhw/GCC_Project + make + +You can use qfprog in a container to program the quickfeather hardware. +Instructions and a Dockerfile are here: +https://github.com/Thirsty2/qfprog + +Or use pip3 to install the programming tool from the QuickLogic github page here: +https://github.com/QuickLogic-Corp/TinyFPGA-Programmer-Application + Hardware features that are not supported in this release -------------------------------------------------------- diff --git a/conda-user.sh b/conda-user.sh new file mode 100755 index 0000000..32ee3c9 --- /dev/null +++ b/conda-user.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e + +source ${INSTALL_DIR}/conda/etc/profile.d/conda.sh +conda activate + +exec "$@" + +conda deactivate +