Skip to content

Commit be40891

Browse files
committed
enhance the readme with tips on acquiring the gnu riscv toolchain
1 parent 3c8601b commit be40891

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Two IEEE 802.15.4 radios are supported out of the box:
1818

1919
## Build
2020

21-
For certain MCUs / Rust targets, the OpenThread libraries are pre-compiled for convenience.
21+
For certain MCUs / Rust targets, the OpenThread libraries are pre-compiled with a commonly used set of defaults for convenience. The defaults allow running a minimal thread device (MTD) that registers services using SRP.
2222
Current list (might be extended upon request):
2323
- `riscv32imac-unknown-none-elf` (ESP32C6 and ESP32H2)
2424
- `thumbv7em-none-eabi` (NRF52)
@@ -30,7 +30,7 @@ Small caveat: since `openthread` does a few calls into the C standard library (p
3030

3131
### Build for other targets / custom build
3232

33-
For targets where pre-compiled libs are not available (including for the Host itself), a standard `build.rs` build is also supported.
33+
For targets where pre-compiled libs are not available (including for the Host itself), or for when additional OpenThread features beyond the defaults are desired, a standard `build.rs` build is also supported.
3434
For the on-the-fly OpenThread CMake build to work, you'll need to install and set in your `$PATH`:
3535
- The GCC toolchain correspponding to your Rust target, with **working** `foo-bar-gcc -print-sysroot` command
3636
- Recent Clang (for Espressif `xtensa`, [it must be the Espressif fork](https://crates.io/crates/espup), but for all other chips, the stock Clang would work)
@@ -41,10 +41,23 @@ As per above, since `openthread` does a few calls into the C standard library (p
4141
Examples of GCC toolchains that are known to work fine:
4242
- For ARM (Cortex M CPUs and others) - the [ARM GNU toolchain](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain);
4343
- Note that the Ubuntu `arm-none-eabi-gcc` system package does **NOT** work, as it does not print a sysroot, i.e. `arm-none-eabi-gcc -print-sysroot` returns an empty response, and furthermore, the `newlib` headers are installed in a separate location from the arch headers;
44-
- For RISCV - the [Espressif RISCV toolchain](https://github.com/espressif/crosstool-NG/releases). The ["official" RISCV GNU toolchain](https://github.com/riscv-collab/riscv-gnu-toolchain) should also work;
44+
- For RISCV - the [Espressif RISCV toolchain](https://github.com/espressif/crosstool-NG/releases). The ["official" RISCV GNU toolchain](https://github.com/riscv-collab/riscv-gnu-toolchain) should also work (see below for guidance on building this);
4545
- For xtensa (Espressif ESP32 and ESP32SXX MCUs) - the [Espressif xtensa toolchain](https://github.com/espressif/crosstool-NG/releases);
4646
- For the Host machine (non-embedded) - your pre-installed toolchain would work just fine.
4747

48+
### Compiling the RISCV GNU Toolchain
49+
As above, the requirements are for the toolchain to have `newlib`, so `--disable-linux` must be specified. For the `riscv32imac-unknown-none-elf` target (ESP32-C6 and ESP32-H2), the following options will produce a usable build:
50+
```
51+
./configure --prefix=/opt/riscv --with-arch=rv32imac --with-abi=ilp32 --disable-linux
52+
make
53+
```
54+
55+
Don't forget to include the resulting binaries in your path:
56+
```
57+
export PATH=$PATH:/opt/riscv/bin
58+
```
59+
60+
4861
## Features
4962

5063
- MTD (Minimal Thread Device) functionality

0 commit comments

Comments
 (0)