From 8e4fda0f0ec444d04589d9a1ab6c4cfc5302d56e Mon Sep 17 00:00:00 2001 From: Alex Bohm Date: Tue, 8 Oct 2024 21:12:41 -0500 Subject: [PATCH] docs(README): Add notes for running ch32v003 examples. --- examples/ch32v003/.cargo/config.toml | 3 +++ examples/ch32v003/README.md | 18 ++++++++++++++++++ .../ch32v003/riscv32ec-unknown-none-elf.json | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/examples/ch32v003/.cargo/config.toml b/examples/ch32v003/.cargo/config.toml index c57a49e..d7b0b7e 100644 --- a/examples/ch32v003/.cargo/config.toml +++ b/examples/ch32v003/.cargo/config.toml @@ -9,6 +9,9 @@ target = "riscv32ec-unknown-none-elf.json" runner = "wlink -v flash --enable-sdi-print --watch-serial" +# Flash and debug chip with probe-rs. https://probe.rs/ +# runner = "probe-rs run --chip ch32v003" + [unstable] build-std = ["core"] # build-std = ["core", "compiler_builtins"] diff --git a/examples/ch32v003/README.md b/examples/ch32v003/README.md index cf08d27..4a3b0fc 100644 --- a/examples/ch32v003/README.md +++ b/examples/ch32v003/README.md @@ -22,3 +22,21 @@ Link: [OSHWHUB](https://oshwhub.com/andelf/linedog) - BUZZ: PC4 (TIM1CH4) - WS2812: PA2 + +## Running Examples + +### Using [wlink](https://github.com/ch32-rs/wlink) +- Install wlink using the installation instructions: https://github.com/ch32-rs/wlink?tab=readme-ov-file#install + +- Edit the [`.cargo/config.toml`](.cargo/config.toml) file so the runner is `wlink`. This may already be the default runner. + +- Build and run the [blinky](src/bin/blinky.rs) example with `cargo run --release --bin blinky`. + +### Using [probe-rs](https://probe.rs/) + +- Install probe-rs using the installation instructions: https://probe.rs/docs/getting-started/installation/ + - If you are on a Linux based system, you may have to add udev rules to allow probe-rs access to the WCH-Link debugger. https://probe.rs/docs/getting-started/probe-setup/#linux%3A-udev-rules + +- Edit the [`.cargo/config.toml`](.cargo/config.toml) file so the runner is `probe-rs run --chip ch32v003`. + +- Build and run the [blinky](src/bin/blinky.rs) example with `cargo run --release --bin blinky`. diff --git a/examples/ch32v003/riscv32ec-unknown-none-elf.json b/examples/ch32v003/riscv32ec-unknown-none-elf.json index e0e853f..e394eb4 100644 --- a/examples/ch32v003/riscv32ec-unknown-none-elf.json +++ b/examples/ch32v003/riscv32ec-unknown-none-elf.json @@ -15,4 +15,4 @@ "panic-strategy": "abort", "relocation-model": "static", "target-pointer-width": "32" - } +} \ No newline at end of file