diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..26f9e3e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM ubuntu:22.04 + +WORKDIR /litex + +# Install dependencies +RUN apt-get update && apt-get install -y wget curl python3 python3-pip git gcc-riscv64-linux-gnu ninja-build +# TODO consolidate curl and wget +RUN pip3 install numpy matplotlib + +# Get and run the LiteX setup script to install LiteX +RUN wget https://raw.githubusercontent.com/enjoy-digital/litex/2023.04/litex_setup.py && chmod +x litex_setup.py +RUN python3 litex_setup.py --init --install --tag=2023.04 + +# Install python dependencies/tools +RUN pip3 install meson + +# Get rust and install the RV32I toolchain +# TODO specify rust version, and can we make this one command? +# TODO make paths more properly generic? +RUN curl https://sh.rustup.rs -sSf | bash -s -- -y +ENV PATH="${HOME}/.cargo/bin:${PATH}" +RUN /root/.cargo/bin/rustup target add riscv32i-unknown-none-elf + +# install oss-cad-suite +WORKDIR / +RUN echo "Fetching oss-cad-suite" && wget -q https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2023-06-03/oss-cad-suite-linux-x64-20230603.tgz +RUN tar -xzf oss-cad-suite-linux-x64-20230603.tgz +RUN rm oss-cad-suite-linux-x64-20230603.tgz +ENV PATH="/oss-cad-suite/bin:${PATH}" + +# Delete package cache to keep size small +RUN apt-get clean + +# Set working directory to repository +WORKDIR /code diff --git a/firmware/build_and_strip.sh b/firmware/build_and_strip.sh index 80c9afd..6f2187d 100755 --- a/firmware/build_and_strip.sh +++ b/firmware/build_and_strip.sh @@ -1,9 +1,16 @@ #!/usr/bin/sh - DEFMT_LOG=trace cargo build --release if [ $? -ne 0 ] then exit $? fi -riscv64-unknown-elf-objcopy -S -O binary target/riscv32i-unknown-none-elf/release/fw fw.bin +# Account for different toolchains +if command -v riscv64-unknown-elf-objcopy +then + objcopy=riscv64-unknown-elf-objcopy +else + objcopy=riscv64-linux-gnu-objcopy +fi + +$objcopy -S -O binary target/riscv32i-unknown-none-elf/release/fw fw.bin diff --git a/gateware/test.py b/gateware/test.py index 595843c..e12092f 100644 --- a/gateware/test.py +++ b/gateware/test.py @@ -3,12 +3,12 @@ Helper functions for a basic test suite """ from typing import Callable, List -from enum import StrEnum +from enum import Enum from dataclasses import dataclass from traceback import print_exc -class TestResult(StrEnum): +class TestResult(str, Enum): PASS = "PASS" FAIL = "FAIL" SKIP = "SKIP"