This commit is contained in:
cpu
2026-05-27 20:05:43 +02:00
parent 0d2e272ed7
commit d7597fb0f1
2 changed files with 22 additions and 6 deletions

View File

@@ -9,8 +9,6 @@ A fail-safe water flow monitoring module designed to protect CNC spindles and la
![ZJ-S401](images/Sensor_ZJ-S401.png) ![ZJ-S401](images/Sensor_ZJ-S401.png)
Designed in **KiCad v9**.
## Table of Contents ## Table of Contents
1. [Features](#features) 1. [Features](#features)
2. [Hardware Design (KiCad)](#hardware-design-kicad) 2. [Hardware Design (KiCad)](#hardware-design-kicad)
@@ -57,7 +55,7 @@ The [scripts](scripts) folder contains a guide to panelize the board (`Flow_Cont
The firmware is written in C using the lightweight `ch32fun` framework. All source files and toolchain documentation are located in the `firmware` folder. The firmware is written in C using the lightweight `ch32fun` framework. All source files and toolchain documentation are located in the `firmware` folder.
**Step-by-step Setup:** **Step-by-step Setup:**
1. Follow the setup guide in [`firmware/Readme.md`](firmware/Readme.md) to install the RISC-V GCC toolchain and `minichlink`. 1. Follow the setup guide in [`firmware`](firmware) to install the RISC-V GCC toolchain and `minichlink`.
2. Connect your **WCH-LinkE** programmer to the 3-pin SWIO header `J1` (+5V, SWIO, GND). 2. Connect your **WCH-LinkE** programmer to the 3-pin SWIO header `J1` (+5V, SWIO, GND).
3. Run `make` to compile the firmware. 3. Run `make` to compile the firmware.
4. Run `make flash` to upload the code to the CH32V003 microcontroller. 4. Run `make flash` to upload the code to the CH32V003 microcontroller.

View File

@@ -10,18 +10,21 @@ Below is the guide to set up the build environment, compile, and flash the CH32V
## 1. Install toolchain ## 1. Install toolchain
Download xPack RISC-V GCC: ### 1.1. Download xPack RISC-V GCC:
[https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases](https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases) [https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases](https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases)
Choose `linux-x64` for X86-64 or `linux-arm64` for ARM64.
Extract it: Extract it:
```bash ```bash
cd ~/Downloads
mkdir -p ~/toolchains mkdir -p ~/toolchains
tar -xzf xpack-riscv-none-elf-gcc-*-linux-x64.tar.gz -C ~/toolchains tar -xzf xpack-riscv-none-elf-gcc-15.2.0-1-linux-x64.tar.gz -C ~/toolchains # Update e.g.: to your version
``` ```
Activate it (add this to your ~/.bashrc for permanence): Activate it (add this to your ~/.bashrc for permanence):
```Bash ```Bash
export TOOLCHAIN=$HOME/toolchains/xpack-riscv-none-elf-gcc-* # Update e.g.: xpack-riscv-none-elf-gcc-15.2.0-1 export TOOLCHAIN=$HOME/toolchains/xpack-riscv-none-elf-gcc-15.2.0-1 # Update e.g.: to your version
export PATH=$TOOLCHAIN/bin:$PATH export PATH=$TOOLCHAIN/bin:$PATH
``` ```
@@ -30,9 +33,24 @@ Verify the installation:
riscv-none-elf-gcc --version riscv-none-elf-gcc --version
``` ```
It should print:
```Bash
riscv-none-elf-gcc (xPack GNU RISC-V Embedded GCC x86_64) 15.2.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
### 1.2. Install dependencies
```bash
sudo apt update
sudo apt install libusb-1.0-0-dev libudev-dev
```
## 2. Install Flashing Tool (minichlink) ## 2. Install Flashing Tool (minichlink)
Clone the ch32fun repository and build minichlink: Clone the ch32fun repository and build minichlink:
```Bash ```Bash
cd ~/
git clone https://github.com/cnlohr/ch32fun ~/ch32fun git clone https://github.com/cnlohr/ch32fun ~/ch32fun
cd ~/ch32fun/minichlink cd ~/ch32fun/minichlink
make make