Skip to content

Commit

Permalink
docs(README): Add notes for running ch32v003 examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbohm committed Oct 9, 2024
1 parent dc44f28 commit f583dd4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/ch32v003/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
18 changes: 18 additions & 0 deletions examples/ch32v003/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
2 changes: 1 addition & 1 deletion examples/ch32v003/riscv32ec-unknown-none-elf.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"panic-strategy": "abort",
"relocation-model": "static",
"target-pointer-width": "32"
}
}

0 comments on commit f583dd4

Please sign in to comment.