-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile.riscv-fpga
59 lines (44 loc) · 2.22 KB
/
Dockerfile.riscv-fpga
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
FROM ubuntu:22.04
LABEL version='{{ version }}'
LABEL org.opencontainers.image.description='{{ readme }}'
LABEL org.opencontainers.image.vendor='{{ author }}'
SHELL ["/bin/bash", "-c"]
ENV WORKDIR=/toolchain
WORKDIR /toolchain
ARG DEBIAN_FRONTEND=noninteractive
# Normal update
RUN apt-get update -y
RUN apt-get -y install curl git pip file cmake
ENV NVM_SH=/root/.nvm/nvm.sh
# Install nvm, node and xpm.
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh > install.sh
RUN echo "8e45fa547f428e9196a5613efad3bfa4d4608b74ca870f930090598f5af5f643 install.sh" > checksum.txt
RUN sha256sum -c checksum.txt
RUN bash ./install.sh
RUN source $NVM_SH
RUN source $NVM_SH && nvm install v16.20.0 && nvm use v16.20.0
RUN source $NVM_SH && npm install --global xpm@0.16.4
# Install gcc toolchain
RUN source $NVM_SH && xpm install --global @xpack-dev-tools/riscv-none-elf-gcc@13.2.0-1.2 --verbose
ENV PATH="/root/.local/xPacks/@xpack-dev-tools/riscv-none-elf-gcc/13.2.0-1.2/.content/bin:$PATH"
# Install 'iceprog' dependencies.
RUN apt-get install -y libftdi-dev
# Install 'yosys' dependencies.
RUN apt-get install -y build-essential clang bison flex \
libreadline-dev gawk tcl-dev libffi-dev git \
graphviz xdot pkg-config python3 libboost-system-dev \
libboost-python-dev libboost-filesystem-dev zlib1g-dev
# Install 'nextpnr' dependencies.
RUN apt-get install -y libboost-all-dev libeigen3-dev
# By default yosys and iceprog are installed in /usr/local/bin/, and for nextpnr we specify it explicitly.
RUN git clone https://github.com/YosysHQ/icestorm && cd icestorm && make -j$(nproc) && make install
RUN git clone https://github.com/YosysHQ/yosys && cd yosys && git submodule update --init --recursive && make -j$(nproc) && make install
RUN git clone https://github.com/YosysHQ/nextpnr && cd nextpnr && cmake . -DARCH=ice40 -DICESTORM_INSTALL_PREFIX=/usr/local/ && make -j$(nproc) && make install
# Make sure all synthesis binaries are in PATH.
RUN which iceprog yosys nextpnr-ice40
# Install RISC-V OpenOCD.
RUN git clone https://github.com/riscv/riscv-openocd
RUN cd riscv-openocd && ./bootstrap && ./configure && make -j$(nproc) && make install
RUN which openocd
# Cleanup the container.
RUN rm -rf icestorm yosys nextpnr riscv-openocd