This document can guide you through the process of preparing the experimental environment required by the programming assignments (HWs) in the Computer Organization course.
In particular, to build the experimental environment, we will show the procedures to install:
1. GNU toolchian for RISC-V (commit hash 59ab58e),
2. RISC-V ISA simulator (Spike; commit hash a22119e), and
3. Proxy kernel (commit hash f036859).
The environmental setup can be done either:
by installing the virtual machine or
by building from the source codes (of the above three software projects).
If you choose to install the virtual machine, you can leverage our prebuilt environment, including Ubuntu Linux 20.04.05 and the above three tools. Please refer to "A. Install the pre-built environment" for more details.
If you choose to build from the source codes, you will need to download the source projects directly from their websites and build the projects from scratch. Please refer to "B. Build from scratch" for more details.
After you installed the tools, you can refer to "Test the RISC-V tools" to make sure that the tools are installed successfully
Click the above download link, and you will enter the download page. Please choose, download, and install the proper version (e.g., Windows, Linux, or macOS/Intel hosts) on your host machine, as highlighted in the image below.
II. Import the prebuilt virtual machine image
You will need to download and uncompress the prebuilt image. Then, you should import the uncompressed image to VirtualBox. The steps to bring up the virtualized Ubuntu environment are listed as follows. 1. Download the prebuilt image Computer Organization HW.zip via the link.
2. Uncompress Computer Organization HW.zip
3. Open your installed VirtualBox software
4. Click Import button
5. Click the Browse file button
6. Choose the file: Computer Organization HW.ova from the folder for the uncompressed zip file
7. Click Finish button
8. Wait for VirtualBox to load the virtual environment
9. You will see the Computer Organization HW virtual machine of the prebuilt environment on the left side bar This means you have imported the prebuilt environment successfully Click 啟動 to power on the virtual machine
10. A new window is created shown the desktop environment of the ubuntu system This means you successfully start the Ubuntu Linux system
Before installing the three RISC-V tools, you need to make sure that your host machine runs Ubuntu Linux (e.g., 20.04.05).
This means that you can either install the Ubuntu Linux on the virtual machine (created by VirtualBox) by yourself. You can refer to the document to know how to create a Ubuntu Linux system with VirtualBox on your own.
Or, it means that you have a machine installed with a Ubuntu Linux environment.
At this point, we assume that you have a workable Ubuntu Linux environment. Please proceed with the following instructions to install the three RISC-V tools
$ sudo mkdir /opt/riscv && sudo mkdir /opt/riscv/bin
$ echo "export RISCV=/opt/riscv" >> ~/.bashrc
$ echo "export PATH="$PATH":/opt/riscv/bin" >> ~/.bashrc
$ source ~/.bashrc
$HOME/riscv/
├── riscv-gnu-toolchain
├── riscv-pk
├── riscv-isa-sim
└── CO_StudentID_HW1/
Run the following commands to Install the tool:The sudo apt install command retrieve and install the necessary packages for the installation of the GNU toolchian.
The git clone command pulls the latest version from the riscv-gnu-toolchain project repository (the latest version would be different from the version listed in the top of this document).
The ./configure command is used to set up the environment variables before building the project.
The sudo make linux -j4 command uses four threads to build the project in parallel. The number of threads can be adjusted to fit the cpu.