These instructions describe how to prepare your computer for the implementation part of this course.
Generally, you will need the following tools.
- Git
- Python 3
make
- C compiler and linker
- C cross-compiler and linker for MIPS32 ABI or RISC-V32 ABI
- MSIM emulator
These tools best work in Linux environments. We do not use other systems and cannot provide support.
MSIM Simulator
MSIM is a lightweight computer simulator supporting both MIPS R4000 processor as well as RISC-V CPU.
Cross compiler and linker
Because probably all of you will compile on non-MIPS or non-RISC-V machines, you will need a so-called cross-compiler. That is compiler that produces code for a different architecture (platform) that the one you are compiling on. Some compilers provide this feature in their base installation, for some one needs to build the compiler with special configuration options.
We use the standard GNU toolchain (GCC and binutils) compiler for MIPS and RISC-V. Probably you will not have these packages available directly in your distribution but you can use ours.
Available Packages
We provide full support for Fedora and Fedora-based Docker images, we offer scripts for compilation from sources. We also provide packages for Ubuntu (but without any further support).
Fedora
Fedora is our distribution of choice and is fully supported.
Installation of all the required tools can be done with the following commands.
# Install base tools
dnf install make gcc git
# Enable our repository on COPR and install the cross-compiler and MSIM
# You will need only one of mipsel-linux-gnu or riscv32-unknown-elf toolchain
dnf install dnf-plugins-core # Might not be needed
dnf copr enable d3s/main
dnf install mffd3s-binutils-mipsel-linux-gnu mffd3s-gcc-mipsel-linux-gnu
dnf install mffd3s-binutils-riscv32-unknown-elf mffd3s-gcc-riscv32-unknown-elf
dnf install msim
Docker/Podman
We provide three images:
registry.gitlab.com/mffd3s/nswi200/base:latest
with base development tools (C compiler, make)registry.gitlab.com/mffd3s/nswi200/mips32:latest
that extends the above image with cross-compilation tools for MIPS32registry.gitlab.com/mffd3s/nswi200/riscv32:latest
that extends the above image with cross-compilation tools for RISC-V 32
These images will be used for CI inside GitLab and you can also use them if you do not wish to install anything in your system.
Please, refer to NSWI177 labs for details on using Docker/Podman if you need a refresher.
To use the images on top of your local clone, something along the following lines should be enough:
podman run \
--rm \
--memory=256m --memory-swap=512m \
-v .:/root/nswi200:rw \
registry.gitlab.com/mffd3s/nswi200/mips32:latest \
/bin/bash -c 'cd /root/nswi200 && make ...'
Ubuntu 24.04
The base tools are covered by the following packages:
apt-get install make git gcc python3
We provide the following packages as-is (none of the teachers use any Debian-based distribution) but we hope they might come useful.
# Linker etc. for MIPS
wget "https://d3s.mff.cuni.cz/f/teaching/nswi200/202425/pkg/ubuntu-24.04/mffd3s-binutils-mipsel-linux-gnu_2.43_amd64.deb" \
&& apt-get install ./mffd3s-binutils-mipsel-linux-gnu_2.43_amd64.deb
# Compiler for MIPS
wget "https://d3s.mff.cuni.cz/f/teaching/nswi200/202425/pkg/ubuntu-24.04/mffd3s-gcc-mipsel-linux-gnu_14.2.0_amd64.deb" \
&& apt-get install ./mffd3s-gcc-mipsel-linux-gnu_14.2.0_amd64.deb
# Linker etc. for RISC-V
wget "https://d3s.mff.cuni.cz/f/teaching/nswi200/202425/pkg/ubuntu-24.04/mffd3s-binutils-riscv32-unknown-elf_2.43_amd64.deb" \
&& apt-get install ./mffd3s-binutils-riscv32-unknown-elf_2.43_amd64.deb
# Compiler for RISC-V
wget "https://d3s.mff.cuni.cz/f/teaching/nswi200/202425/pkg/ubuntu-24.04/mffd3s-gcc-riscv32-unknown-elf_14.2.0_amd64.deb" \
&& apt-get install ./mffd3s-gcc-riscv32-unknown-elf_14.2.0_amd64.deb
MSIM can be installed from GitHub release page where the DEB package is built for each release automatically.
Building From Sources
If none of the above is suitable for your system, you can build the toolchain from sources. We provide scripts and instructions in a separate repository that also hosts generation of the Docker images.
The repository is located at https://gitlab.com/mffd3s/nswi200.