|
|
|
# Setting up the lab environment
|
|
|
|
|
|
|
|
The process here varies by the operating system you're running.
|
|
|
|
|
|
|
|
## Linux
|
|
|
|
|
|
|
|
### Ubuntu
|
|
|
|
|
|
|
|
It's always a good idea to update first, to do that, run the following in a terminal:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo apt update && sudo apt upgrade -y
|
|
|
|
```
|
|
|
|
|
|
|
|
Now, install the MIPS GNU toolchain, by running
|
|
|
|
```bash
|
|
|
|
sudo apt-get install binutils-mips-linux-gnu
|
|
|
|
```
|
|
|
|
|
|
|
|
If the installation has been successful, running
|
|
|
|
```bash
|
|
|
|
which mips-linux-gnu-as
|
|
|
|
```
|
|
|
|
should return
|
|
|
|
```bash
|
|
|
|
/usr/bin/mips-linux-gnu-as
|
|
|
|
```
|
|
|
|
|
|
|
|
To compile the code you will need ``make``, and to run SyncSim you'll need a Java Runtime Environment. Run following command to install ``make`` and ``java``.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo apt install make openjdk-jre-21
|
|
|
|
```
|
|
|
|
|
|
|
|
Now you should be able to compile the code for the labs by writing the command ``make`` in any folder containing a Makefile. You can move on to the [General Linux](#general-linux) chapter.
|
|
|
|
|
|
|
|
### Arch-based distros
|
|
|
|
|
|
|
|
The AUR package [``mips-linux-gnu-binutils``](https://aur.archlinux.org/packages/mips-linux-gnu-binutils) is tested and works. You can install it either via ``makepkg``:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
git clone https://aur.archlinux.org/mips-linux-gnu-binutils.git
|
|
|
|
cd mips-linux-gnu-binutils
|
|
|
|
makepkg -si
|
|
|
|
```
|
|
|
|
|
|
|
|
Or through your favorite AUR helper, like ``yay``.
|
|
|
|
|
|
|
|
If the installation has been successful, running
|
|
|
|
```bash
|
|
|
|
which mips-linux-gnu-as
|
|
|
|
```
|
|
|
|
should return
|
|
|
|
```bash
|
|
|
|
/usr/bin/mips-linux-gnu-as
|
|
|
|
```
|
|
|
|
|
|
|
|
To compile the code you will need the ``make`` command, and to run SyncSim you'll need a Java Runtime Environment. Run following command to install ``make`` and ``java``.
|
|
|
|
```bash
|
|
|
|
sudo pacman -S jre21-openjdk make
|
|
|
|
```
|
|
|
|
You can now move on to the [General Linux](#general-linux) chapter.
|
|
|
|
|
|
|
|
### General Linux
|
|
|
|
|
|
|
|
Once Java has been installed, to download SyncSim run
|
|
|
|
```bash
|
|
|
|
wget https://vesuvio-git.neteq.ltu.se/d0013e-microcomputer-engineering/info/-/wikis/uploads/01c56a0806abeb2b69c5d220edbab141/SyncSim.jar
|
|
|
|
```
|
|
|
|
You can now try running SyncSim:
|
|
|
|
```bash
|
|
|
|
java -jar SyncSim.jar --mips
|
|
|
|
```
|
|
|
|
If SyncSim starts successfully, congratulations, you are ready to start working on [lab0a](https://vesuvio-git.neteq.ltu.se/d0013e-microcomputer-engineering/lab0a). If it doesn't, let us know on Discord or at a lab session.
|
|
|
|
|
|
|
|
|
|
|
|
## Windows
|
|
|
|
|
|
|
|
Assuming you've followed the [WSL guide](https://vesuvio-git.neteq.ltu.se/d0013e-microcomputer-engineering/info/-/wikis/How%20to%20Linux%20in%20Windows) successfully, you should be able to follow the Ubuntu Linux guide [here](#ubuntu)
|
|
|
|
|
|
|
|
## macOS
|
|
|
|
|
|
|
|
Start with installing Apple's command line developer tools by running the following in a terminal:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
xcode-select --install
|
|
|
|
```
|
|
|
|
|
|
|
|
Now, install MacPorts from [here](https://www.macports.org/install.php). Default settings should be fine.
|
|
|
|
|
|
|
|
Finally, run
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo port install mips-elf-binutils
|
|
|
|
```
|
|
|
|
|
|
|
|
in a terminal to install the MIPS GNU Toolchain.
|
|
|
|
|
|
|
|
You also need some sort of Java Runtime Environment to run SyncSim. You can get it from [here](https://www.oracle.com/java/technologies/downloads/#jdk22-mac). The DMG is probably the easiest option (be mindful of the target architecture, for Apple Silicon, i.e. MX chips you're looking for the ARM64 version. For other Macs, the x64 version should be fine.)
|
|
|
|
|
|
|
|
You can verify JDK has been installed successfully by running
|
|
|
|
```bash
|
|
|
|
java -v
|
|
|
|
```
|
|
|
|
in a terminal.
|
|
|
|
|
|
|
|
|
|
|
|
Once Java has been installed, to download SyncSim run
|
|
|
|
```bash
|
|
|
|
wget https://vesuvio-git.neteq.ltu.se/d0013e-microcomputer-engineering/info/-/wikis/uploads/01c56a0806abeb2b69c5d220edbab141/SyncSim.jar
|
|
|
|
```
|
|
|
|
You can now try running SyncSim:
|
|
|
|
```bash
|
|
|
|
java -jar SyncSim.jar --mips
|
|
|
|
```
|
|
|
|
If SyncSim starts successfully, congratulations, you are ready to start working on [lab0a](https://vesuvio-git.neteq.ltu.se/d0013e-microcomputer-engineering/lab0a). If it doesn't, let us know on Discord or at a lab session.
|
|
|
|
|
|
|
|
|
|
|
|
### SDE toolchain (legacy)
|
|
|
|
In case the above steps do not work, you can try using the tried and true (albeit deprecated) SDE toolchain. The instructions below should work under Ubuntu Linux (so, also default WSL), and similar Debian based distributions.
|
|
|
|
|
|
|
|
To set up the SDE toolchain, you can start by downloading it through the following command (in either your Linux terminal or WSL):
|
|
|
|
|
|
|
|
```bash
|
|
|
|
wget https://vesuvio-drive.neteq.ltu.se/s/rs3mCj4iyTdT2MG/download/mips-sde-binaries.tar
|
|
|
|
```
|
|
|
|
|
|
|
|
To unpack the archive, run the command below in the same folder as you put the mips-sde-binaries.tar file.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
tar -xf mips-sde-binaries.tar
|
|
|
|
```
|
|
|
|
|
|
|
|
Copy the files to the folder /usr/local/bin/ that usually is included in your $PATH variable.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo cp mips-sde-binaries-extracted/mips-sde/* /usr/local/bin/
|
|
|
|
```
|
|
|
|
|
|
|
|
The packages above rely on 32-bit versions of certain libraries. Run the commands below to install them.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo dpkg --add-architecture i386
|
|
|
|
sudo apt update
|
|
|
|
sudo apt dist-upgrade
|
|
|
|
sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386
|
|
|
|
```
|
|
|
|
|
|
|
|
The MIPS tools archive (see above) contains SyncSim and the command syncsim. You can run it in a terminal and give it arguments, which it passes on to SyncSim.jar. E.g., _syncsim --mips-ext_ starts SyncSim in pipeline and co-processor mode. See [The SyncSim simulator](The SyncSim simulator) for more flags.
|
|
|
|
|
|
|
|
## Troubleshooting
|
|
|
|
|
|
|
|
|
|
|
|
Check that the files exists in /usr/local/bin.
|
|
|
|
```bash
|
|
|
|
ls /usr/local/bin | grep sde
|
|
|
|
```
|
|
|
|
You should see following:
|
|
|
|
```bash
|
|
|
|
sde-addr2line
|
|
|
|
sde-ar
|
|
|
|
sde-as
|
|
|
|
sde-c++
|
|
|
|
sde-c++filt
|
|
|
|
sde-conv
|
|
|
|
sde-cpp
|
|
|
|
sde-g++
|
|
|
|
sde-gcc
|
|
|
|
sde-gcc-3.4.4
|
|
|
|
sde-gccbug
|
|
|
|
sde-gcov
|
|
|
|
sde-gdb
|
|
|
|
sde-gprof
|
|
|
|
sde-insight
|
|
|
|
sde-ld
|
|
|
|
sde-make
|
|
|
|
sde-nm
|
|
|
|
sde-objcopy
|
|
|
|
sde-objdump
|
|
|
|
sde-ranlib
|
|
|
|
sde-readelf
|
|
|
|
sde-run
|
|
|
|
sde-runtest
|
|
|
|
sde-size
|
|
|
|
sde-strings
|
|
|
|
sde-strip
|
|
|
|
```
|
|
|
|
|
|
|
|
If you don't, then you haven't moved the sde files in to _/usr/local/bin/_ correctly.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
Verify /usr/local/bin is in $PATH.
|
|
|
|
```bash
|
|
|
|
echo $PATH
|
|
|
|
```
|
|
|
|
If not you need to add it to your $PATH. This command does it temporary
|
|
|
|
```
|
|
|
|
export PATH=$PATH:/usr/local/bin
|
|
|
|
```
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
Your version of Linux might not have enabled 32-bits instructions and the it looks like it can't find sde-as. Try to install _libc6:i386, libncurses5:i386, libstdc++6:i386_ again.
|
|
|
|
|
|
|
|
---
|
|
|
|
Notice, 32-bit compatibility works only with WSL-2 (not WSL-1). You can check your WSL version by running in your windows (power) shell:
|
|
|
|
|
|
|
|
```
|
|
|
|
wsl --list --verbose
|
|
|
|
```
|
|
|
|
|
|
|
|
If it indicates WSL 1, you can either upgrade to WSL 2 or unistall WSL 1 and reinstall WSL 2.
|
|
|
|
https://superuser.com/questions/1560850/should-i-uninstall-wsl-or-the-old-linux-distro-before-installing-wsl2
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## Other Linux
|
|
|
|
|
|
|
|
The tools should work in other modern linux distributions as well. You will need to install 32bit compatibility libraries, `lib32-glibc` and `lib32-ncurses`. (Under arch linux, they are available in you package manager (pacman by default). |