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
  • MSIM emulator of the R4000 processor

These tools best work in Linux environments. We do not use other systems and cannot provide support.

MSIM MIPS R4000 Simulator

MSIM is a lightweight computer simulator based on the MIPS R4000 processor.

Available Packages

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
dnf copr enable d3s/teaching
dnf install mff-nswi004-binutils-mipsel-linux-gnu mff-nswi004-gcc-mipsel-linux-gnu
dnf install mff-nswi004-gdb-mipsel-linux-gnu
dnf install msim-git

Docker/Podman

We provide two images:

  • registry.gitlab.com/mffd3s/nswi004/base:latest with base development tools (C compiler, make)
  • registry.gitlab.com/mffd3s/nswi004/mips32:latest that extends the above image with cross-compilation tools for MIPS32

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/nswi004:rw \
    registry.gitlab.com/mffd3s/nswi004/mips32:latest \
    /bin/bash -c 'cd /root/nswi004 && make ...'

Ubuntu 20.04

The base tools are covered by the following packages:

apt-get install make git gcc python3

The following packages are provided as-is as none of the teachers use any Debian-based distribution.

mkdir nswi004-packages
for i in \
        mff-nswi004-binutils-mipsel-linux-gnu_2.35.1_amd64.deb \
        mff-nswi004-gcc-mipsel-linux-gnu_11.2.0_amd64.deb \
        mff-nswi004-gdb-mipsel-linux-gnu_8.3.1_amd64.deb \
        msim_1.4.2-git_amd64.deb; do \
    wget "https://d3s.mff.cuni.cz/f/teaching/nswi004/resources/pkg/ubuntu-20.04/$i" -O "nswi004-packages/$i"; \
done

apt-get install ./nswi004-packages/*.deb

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/nswi004.