/gd32vf103-samples

Sample Rust programs for the GD32VF103

Primary LanguageRustApache License 2.0Apache-2.0

Overview

This repository provides examples of using Rust to program the GD32VF103 MCU. All of these build on foundational crates provided by the Rust Embedded Working Group.

Available examples:

Building

These examples can be compiled and flashed from any Windows or Linux system.

Prerequisites:

  • Stable Rust w/ riscv32imac-unknown-none-elf target
  • Nuclei RISC-V toolchain (needed only for objcopy)
  • Modified dfu-util with support for GD32V bootloader
    • As mentioned in the release notes, Windows users must also use Zadig to configure WinUSB for the enumerated USB bootloader
  • Clone this repository and initialize submodules

To build and flash blinky:

cargo build --bin blinky --release
riscv-nuclei-elf-objcopy target/riscv32imac-unknown-none-elf/release/blinky -O binary -S blinky.bin
dfu-util -d 28e9:0189 -a 0 --dfuse-address 0x08000000:leave -D blinky.bin

Note that dfu-util requires the device to be in bootloader mode.

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.