This is studying Rust embedded-hal for WCH CH32V103 project.
Connect KEY pin to BOOT0 and BOOT1 to GND. The KEY pin is Pull-Uped and goes to L by pressing the User button.
To download firmware, press RST button and release it. To run downloaded firmware, press RST and User buttons and release them.
$ rustup target add riscv32imac-unknown-none-elf
$ sudo apt install binutils-riscv64-unknown-elf
$ cargo install wchisp
$ sudo chow root:root $HOME/.cargo/bin/wchisp
$ sudo chmod u+s $HOME/.cargo/bin/wchisp
Clear Cargo cache
$ cargo install cargo-cache
$ #cargo cache -a
$ cargo cache -r all
$ cd samples/blinky && make release && make flash
$ cargo install cargo-expand
$ cargo expand --package ch32v103_hal
How to get assembly output from building with Cargo?
$ cargo rustc --release -- --emit asm
$ ls target/<ARCH>/release/deps/*.s
or
$ cargo install cargo-show-asm
$ cargo asm --bin <PACKAGE.NAME>
Embedded Rust Techniques 3-1. Cargo
$ cargo install cargo-binutils
$ rustup component add llvm-tools-preview
$ cargo objdump --release -- -d --no-show-raw-insn --print-imm-hex