Appendix

Building the GNU Toolchain

General Information

This chapter explains how to install a version of the GNU Toolchain that includes a version of GDB (GNU Debugger) in which the text user interface (tui) is enabled.

Prerequisites:

  • libncurses-dev to be able to compile GDB with tui

  • The packages listed here: RISC-V Collab Github

  • a symbolic link “python” that points to “python3”

Information:

  • GCC Version: 12.2.0

  • Buildtime with the -j4 option: 22 minutes

  • Size required for the repository: 11 GB

  • Site required for installed Toolchain: 1.4 GB

  • Installs the complete “riscv-gnu-toolchain” with an multilb newlib

Installation

  1. Install libncurses (on debian):

$ sudo apt install libncurses-dev
  1. If the “python” command is not available on your system you need to create a symbolic link named “python” pointing to the “python3” executable.

  2. Download the source code from the GitHub repository.

$ git clone https://github.com/riscv/riscv-gnu-toolchain
  1. Change directory into the newly downloaded repository.

$ cd riscv-gnu-toolchain
  1. Checkout the Version “2023.01.04” (GCC 12.2.0) with the following command

$ git checkout 2023.01.04
  1. Configuring the toolchain with the following command (remove the \from the command):

$ ./configure --prefix=/home/<username>/toolchain \
--with-multilib-generator="rv32i-ilp32--;rv32im-ilp32--;rv32ima-ilp32--"

Note

Note that the given prefix path is only a sugestion and can be changed by the user.

  1. Compile and install the toolchain.

$ make

Note

Running the make command builds and installs the toolchain. If writing to the directory specified with --prefix= requires root privileges, these need to be given in order to successfully run the make command.