Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update toolchain to release 20220210-1 with bitmanip support #10766

Merged
merged 1 commit into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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