Skip to content

Commit

Permalink
Update toolchain to release 20220210-1 with bitmanip support
Browse files Browse the repository at this point in the history
This release updates the meson cross files to make the toolchains more
easily configurable. The tool versions for the bitmanip variant are:

- Binutils 2.35
- GCC: 10.2.0
- Clang/LLVM: 13.0.1
- GDB 11.1

- Binutils: `7c9dd840fbb6a1171a51feb08afb859288615137`
  (riscv-binutils-2.35-rvb) with Pirmin's bitmanip 1.00+0.93 PR patch
  (riscvarchive/riscv-binutils-gdb#267).
- GCC: `73055647d33c0b63a3125c372019d1dac0f8ac34` (RISC-V bitmanip fork,
  branch riscv-gcc-10.2.0-rvb, commit 73055647d33 from 2021-07-09)
- Clang/LLVM: 13.0.1
- GDB 11.1

Signed-off-by: Luís Marques <luismarques@lowrisc.org>
  • Loading branch information
luismarques authored and MaayanKashani committed Feb 28, 2022
1 parent 2181cac commit 6adb272
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 60 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ variables:
VERIBLE_VERSION: v0.0-1213-g9e5c085
RUST_VERSION: 1.55.0
# Release tag from https://github.com/lowRISC/lowrisc-toolchains/releases
TOOLCHAIN_VERSION: 20210412-1
TOOLCHAIN_VERSION: 20220210-1
# This controls where builds happen, and gets picked up by build_consts.sh.
BUILD_ROOT: $(Build.ArtifactStagingDirectory)
VIVADO_VERSION: "2020.2"
Expand Down
62 changes: 6 additions & 56 deletions doc/ug/install_instructions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,14 @@ $ pip3 install --user -r python-requirements.txt

## Software development

### Device compiler toolchain (RV32IMC)
### Device compiler toolchain

To build device software you need a baremetal RV32IMC compiler toolchain.
To build device software you need a baremetal RISC-V toolchain.
We recommend using a prebuilt toolchain provided by lowRISC.
Alternatively, you can build your own.
Whichever option you choose, we recommend installing the toolchain to `/tools/riscv`.
The prebuilt toolchains contain both GCC and Clang, targeting RISC-V.
By default the OpenTitan device software is built with Clang.

#### Option 1 (recommended): Use the lowRISC-provided prebuilt toolchain

lowRISC provides a prebuilt toolchain for the OpenTitan project.
This toolchain contains both GCC and Clang, targeting RISC-V.
By default the device software is built with Clang.
We recommend using the `util/get-toolchain.py` tool to download and install the latest version of this toolchain.
We recommend using the `util/get-toolchain.py` tool to download and install the latest version of this toolchain, and that you install the toolchain to the default path, `/tools/riscv`.

```cmd
$ cd $REPO_TOP
Expand All @@ -175,52 +170,7 @@ $ ./util/get-toolchain.py

This tool will automatically adjust the toolchain configuration if you override the installation directory (by using the `--install-dir` option).
It also provides the ability to perform a staged installation (by supplying a `--dest-dir` option), if the toolchain needs to be unpacked first at a temporary staging directory, before it can be moved to the final installation directory.
Alternatively, manually download the file starting with `lowrisc-toolchain-rv32imc-` from [GitHub releases](https://github.com/lowRISC/lowrisc-toolchains/releases/latest) and unpack it to the desired installation directory.

#### Option 2: Compile your own GCC toolchain

1. Install all build prerequisites listed [in the documentation](https://github.com/riscv/riscv-gnu-toolchain/#prerequisites).

2. Build the toolchain (this should be done outside the `$REPO_TOP` directory):
```console
$ git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
$ cd riscv-gnu-toolchain
$ ./configure --prefix=/tools/riscv --with-abi=ilp32 --with-arch=rv32imc --with-cmodel=medany
$ make
```

The `make` command installs the toolchain to `/tools/riscv`, no additional `make install` step is needed.

3. Write a [meson toolchain configuration file](https://mesonbuild.com/Cross-compilation.html#defining-the-environment) for your toolchain.
It should look like the following (though your paths may be different):
```ini
[binaries]
c = '/tools/riscv/bin/riscv32-unknown-elf-gcc'
cpp = '/tools/riscv/bin/riscv32-unknown-elf-g++'
ar = '/tools/riscv/bin/riscv32-unknown-elf-ar'
ld = '/tools/riscv/bin/riscv32-unknown-elf-ld'
objdump = '/tools/riscv/bin/riscv32-unknown-elf-objdump'
objcopy = '/tools/riscv/bin/riscv32-unknown-elf-objcopy'
strip = '/tools/riscv/bin/riscv32-unknown-elf-strip'
as = '/tools/riscv/bin/riscv32-unknown-elf-as'

[properties]
needs_exe_wrapper = true
has_function_printf = false
c_args = ['-march=rv32imc', '-mabi=ilp32', '-mcmodel=medany']
c_link_args = ['-march=rv32imc', '-mabi=ilp32', '-mcmodel=medany']
cpp_args = ['-march=rv32imc', '-mabi=ilp32', '-mcmodel=medany']
cpp_link_args = ['-march=rv32imc', '-mabi=ilp32', '-mcmodel=medany']

[host_machine]
system = 'bare metal'
cpu_family = 'riscv32'
cpu = 'ibex'
endian = 'little'
```

You will need to pass the path to this file to `./meson_init.sh` using the `-t FILE` option.

Alternatively, manually download the file starting with `lowrisc-toolchain-rv32imcb-` from [GitHub releases](https://github.com/lowRISC/lowrisc-toolchains/releases/latest) and unpack it to the desired installation directory.

### OpenOCD

Expand Down
2 changes: 1 addition & 1 deletion util/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ARG VERILATOR_VERSION=4.210
ARG OPENOCD_VERSION=0.11.0
ARG VERIBLE_VERSION=v0.0-1213-g9e5c085
# The RISCV toolchain version should match the release tag used in GitHub.
ARG RISCV_TOOLCHAIN_TAR_VERSION=20210412-1
ARG RISCV_TOOLCHAIN_TAR_VERSION=20220210-1
ARG RUST_VERSION=1.55.0

# Main container image.
Expand Down
4 changes: 2 additions & 2 deletions util/get-toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# the keys in this dictionary specify valid toolchain kinds
ASSET_PREFIXES = {
# kind : prefix,
"combined": "lowrisc-toolchain-rv32imc-",
"gcc-only": "lowrisc-toolchain-gcc-rv32imc-",
"combined": "lowrisc-toolchain-rv32imcb-",
"gcc-only": "lowrisc-toolchain-gcc-rv32imcb-",
}
ASSET_SUFFIX = ".tar.xz"
RELEASES_URL_BASE = 'https://api.github.com/repos/lowRISC/lowrisc-toolchains/releases'
Expand Down

0 comments on commit 6adb272

Please sign in to comment.