add dockerfile so we can build

This commit is contained in:
David Lenfesty 2023-06-03 15:17:39 -06:00
parent 1abbe4ea97
commit d691f2a649
3 changed files with 46 additions and 4 deletions

35
Dockerfile Normal file
View File

@ -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

View File

@ -1,9 +1,16 @@
#!/usr/bin/sh #!/usr/bin/sh
DEFMT_LOG=trace cargo build --release DEFMT_LOG=trace cargo build --release
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
exit $? exit $?
fi 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

View File

@ -3,12 +3,12 @@ Helper functions for a basic test suite
""" """
from typing import Callable, List from typing import Callable, List
from enum import StrEnum from enum import Enum
from dataclasses import dataclass from dataclasses import dataclass
from traceback import print_exc from traceback import print_exc
class TestResult(StrEnum): class TestResult(str, Enum):
PASS = "PASS" PASS = "PASS"
FAIL = "FAIL" FAIL = "FAIL"
SKIP = "SKIP" SKIP = "SKIP"