https://github.com/ghostiam/ch32_zig
WCH CH32 HAL in Zig. Compile simply with `zig build`.
https://github.com/ghostiam/ch32_zig
ch32 ch32v ch32v003 embedded embedded-zig wch zig ziglang
Last synced: 6 months ago
JSON representation
WCH CH32 HAL in Zig. Compile simply with `zig build`.
- Host: GitHub
- URL: https://github.com/ghostiam/ch32_zig
- Owner: ghostiam
- License: mit
- Created: 2025-02-24T22:49:14.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2025-03-26T20:57:17.000Z (6 months ago)
- Last Synced: 2025-03-26T21:34:00.235Z (6 months ago)
- Topics: ch32, ch32v, ch32v003, embedded, embedded-zig, wch, zig, ziglang
- Language: Zig
- Homepage:
- Size: 19.3 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WCH CH32 HAL in Zig
HAL(Hardware Abstraction Layer) for the WCH CH32 series of microcontrollers written in Zig.
## TODO
The [minichlink](tools/minichlink) flasher is also included and can be
compiled using `zig build` as well.## Getting Started
> \[!NOTE\]
> If you are using `nix`, you can simply run `nix develop` in the root of the project, and it will automatically install
> `zig`, `zigscient`, `minichlink` and `wch-openocd` in your environment.
> And you can skip to the [Build and upload the example](#build-and-upload-the-example) section.### Install Zig
Currently, the examples are tested with `0.14.0`.\
You can download the latest version from:
https://ziglang.org/download/### Build the flasher
```shell
cd tools/minichlink
zig build# Add the `minichlink` to your `PATH`:
export PATH=$PATH:$(pwd)/zig-out/bin
```### Build and upload the example
```shell
cd examples/blink
zig build
minichlink -w zig-out/firmware/ch32v003_blink.bin flash -b
```## Basic Examples
If you want to learn more about how everything works, I recommend checking out the repository with basic examples that
are based on the use of registers without
abstractions: [ch32v003_basic_zig](https://github.com/ghostiam/ch32v003_basic_zig)## Size benchmark
See [SIZE_BENCHMARK.md](SIZE_BENCHMARK.md)
## Useful Notes
See [USEFUL_NOTES.md](USEFUL_NOTES.md)