Skip to content
Open
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
49 changes: 41 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,24 @@
rustup target add riscv32imac-unknown-none-elf
```

Either:

- RISC-V toolchain ([e.g. from SiFive](https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz))

One of:
or install prebuilt toolchain (easier):

For Ubuntu/Debian:
```
sudo apt-get install gcc-riscv64-unknown-elf
```

For Fedora:

```
sudo dnf install binutils-riscv64-linux-gnu
```

For flashing, one of:

- [dfu-util](http://dfu-util.sourceforge.net/)
- [openocd for GD32VF103](https://github.com/riscv-mcu/riscv-openocd)
Expand All @@ -31,13 +46,6 @@ One of:

When using `dfu-util`, the RISC-V toolchain is not necessary. Only `rust-objcopy` from [cargo-binutils](https://github.com/rust-embedded/cargo-binutils) is needed.

Option B - Install prebuilt toolchain (easier):

For Ubuntu/Debian:
```
sudo apt-get install gcc-riscv64-unknown-elf
```

### Building

If you have a GD32VF103C**B** chip on your board, edit `.cargo/config.toml` and replace
Expand All @@ -48,6 +56,31 @@ To build all the provided examples run
cargo build --examples --release --all-features
```

#### Building everything including core

An option for using only distribution packaging, no rustup, is to let the compiler pretend it's unstable and build the `core` crate.

Install rust and its sources, and the lld linker.

Fedora:

```
sudo dnf install rust rust-src lld
```

In `.cargo/config` add:

```
[target.riscv32imac-unknown-none-elf]
linker = 'lld'
```

Use the following command to build:

```
RUSTC_BOOTSTRAP=1 cargo build -Z build-std --examples --release --all-features
```

### Using dfu-util for Flashing

The GD32VF103 contains a [DFU](https://www.usb.org/sites/default/files/DFU_1.1.pdf)
Expand Down
Loading