An open source WCH-Link library/command line tool written in Rust.

Overview

wlink - WCH-Link command line tool

Crates.io Crates.io docs.rs GitHub release

NOTE: This tool is still in development and not ready for production use.

Known Issue:

  • Only support binary firmware file

Tested On

Probes

  • WCH-Link CH549
  • WCH-LinkE CH32V305

MCU

  • CH32V003 - flash ok, reset not work
  • CH32V103 - flash ok
  • CH32V203 - flash & reset ok
  • CH32V307 - flash & reset ok
  • ... (Feel free to open an issue if you have tested on other chips)

Install

cargo install --git or download a binary from the Nightly Release page.

Usage

> # Flash firmware.bin to Code FLASH
> cargo run -- flash ./firmware.bin`
16:55:56 [INFO] WCH-Link v2.7 (WCH-Link-CH549)
16:55:56 [INFO] attached chip: CH32V20x(0x20360510)
16:55:56 [INFO] flash 860 bytes
16:55:57 [INFO] flash done
16:55:58 [INFO] now reset...
16:55:59 [INFO] resume executing...

> # Dump Code FLASH, for verification
> cargo run -- -v dump 0x08000000 100`
18:31:18 [DEBUG] (1) wlink::device: Acquired libusb context.
18:31:18 [DEBUG] (1) wlink::device: Claimed interface 0 of USB device.
18:31:18 [INFO] WCH-Link v2.8 (WCH-LinkE-CH32V305)
18:31:18 [DEBUG] (1) wlink::operations: attached chip: ChipInfo { chip_family: CH32V20x, chip_type: "0x20360510" }
18:31:18 [DEBUG] (1) wlink::operations: Chip UID: cd-ab-b4-ae-45-bc-c6-16
18:31:18 [DEBUG] (1) wlink::operations: flash protected: false
18:31:18 [DEBUG] (1) wlink::operations: SRAM CODE mode: 3
18:31:18 [DEBUG] (1) wlink::operations: RISC-V core version: Some("WCH-V4B")
18:31:18 [INFO] Read memory from 0x08000000 to 0x08000064
08000000:   b7 00 00 08  67 80 80 00  73 50 40 30  73 50 40 34   ×00•g××0sP@0sP@4
08000010:   81 40 01 41  81 41 01 42  81 42 01 43  81 43 01 44   ×@•A×A•B×B•C×C•D
08000020:   81 44 81 46  01 47 81 47  01 48 81 48  01 49 81 49   ×D×F•G×G•H×H•I×I
08000030:   01 4a 81 4a  01 4b 81 4b  01 4c 81 4c  01 4d 81 4d   •J×J•K×K•L×L•M×M
08000040:   01 4e 81 4e  01 4f 81 4f  97 01 00 18  93 81 81 7b   •N×N•O×Oו0•×××{
08000050:   f3 23 40 f1  b7 02 00 00  93 82 02 00  63 f4 72 00   ×#@×ו00×ו0c×r0
08000060:   6f 00 c0 29                                          o0×)

> # Dump System FLASH, BOOT_28KB
> cargo run -- dump 0x1FFF8000 0x7000
....

> # Dump all general purpose registers
> cargo run -- regs
16:24:20 [INFO] Dump GPRs
dpc(pc):   0x2000011a
x0   zero: 0x00000000
x1     ra: 0x49c85c07
x2     sp: 0x20002800
x3     gp: 0x206e24c4
x4     tp: 0x9add07a3
x5     t0: 0xb4a9b38a
....


> # Set dpc(pc) to System Flash and Run - Not working :(
> cargo run -- write-reg 0x7b1 0x1fff8000

References

You might also like...
repl / scripting language / namespaced command line aliases

Adana Toy project with the following goals in mind: Making something concrete with rust Learning more about parser combinator Use the minimum amount o

Utilities for converting Vega-Lite specs from the command line and Python

VlConvert VlConvert provides a Rust library, CLI utility, and Python library for converting Vega-Lite chart specifications into static images (SVG or

Tool to convert variable and function names in C/C++ source code to snake_case

FixNameCase Tool to convert variable and function names in C/C++ source code to snake_case. Hidden files and files listed in .gitignore are untouched.

Salty and Sweet one-line Rust Runtime Optimization Library

SAS SAS (Salty-And-Sweet) is an one-line Rust runtime optimization library. Features NUMA-aware rayon: numa feature should be enabled If you have 1 NU

The source code that accompanies Hands-on Rust: Effective Learning through 2D Game Development and Play by Herbert Wolverson
The source code that accompanies Hands-on Rust: Effective Learning through 2D Game Development and Play by Herbert Wolverson

Hands-on Rust Source Code This repository contains the source code for the examples found in Hands-on Rust. These are also available from my publisher

This repository contains the source of "The Rust Programming Language" book.

The Rust Programming Language This repository contains the source of "The Rust Programming Language" book. The book is available in dead-tree form fro

This repository contains the Rust source code for the algorithms in the textbook Algorithms, 4th Edition

Overview This repository contains the Rust source code for the algorithms in the textbook Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

Source code for the book Rust in Action

Welcome to Rust in Action source code This source code repository is a companion to the Rust in Action book available from Manning Publications. Suppo

Source code of Ferrocene, safety-critical Rust toolchain

Ferrocene is a toolchain to enable the use of the Rust programming language in safety-critical environments. It is a proper downstream of the main Rus

Owner
WCH MCU for Rust
Rust support projects for WCH's 32-bit microcontrollers
WCH MCU for Rust
Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study

Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study

Jason Shin 9 Apr 10, 2022
Maai_core is an open source AI that is written in rust

maai_core is an open source AI that is written in rust. It is more focused on being lightweight and speedy.

Max Beier 2 Aug 1, 2022
Quickly set up a `probe-run` + `defmt` + `flip-link` embedded project

app-template Quickly set up a probe-run + defmt + flip-link embedded project Dependencies 1. flip-link: $ cargo install flip-link 2. probe-run: $ # ma

Knurling 201 Dec 29, 2022
Open-source Autonomy Software in Rust-lang with gRPC for the Roomba series robot vacuum cleaners

CleanIt Open-source Autonomy Software in Rust-lang with gRPC for the Roomba series robot vacuum cleaners Motivation Motivation is to build a complete

Kristoffer Rakstad Solberg 216 Dec 13, 2022
Diosic is an open source web-based music collection server and streamer

Diosic is an open source web-based music collection server and streamer. Mainly suitable for users who need to deploy on servers with low hardware specifications.

Jinker 45 Jan 28, 2023
Open source bible study program on Linux!

Open Witness Library Open Witness Library is a program to read articles that carries God's true name. Warning This branch is outdated, please refer to

Wellington Júnior 5 Jun 29, 2023
An open-source UCIe implementation developed at UC Berkeley.

UCIe An open-source UCIe implementation developed at UC Berkeley. This project is very early-stage. If you are interested in contributing, see below.

null 3 Aug 18, 2023
An AI-native lightweight, reliable, and high performance open-source vector database.

What is OasysDB? OasysDB is a vector database that can be used to store and query high-dimensional vectors. Our goal is to make OasysDB fast and easy

Oasys 3 Dec 25, 2023
Rust command-line tool to encrypt and decrypt files or directories with age

Bottle A Rust command-line tool that can compress and encrypt (and decrypt and extract) files or directories using age, gzip, and tar. Bottle has no c

Sam Schlinkert 1 Aug 1, 2022
A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library!

cabal-pack A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! To generate bindings, you need to annotate the Rust

Yvan Sraka 18 Dec 31, 2022