diff --git a/Readme.md b/Readme.md index d097714..981c188 100644 --- a/Readme.md +++ b/Readme.md @@ -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) -Designed in **KiCad v9**. - ## Table of Contents 1. [Features](#features) 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. **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). 3. Run `make` to compile the firmware. 4. Run `make flash` to upload the code to the CH32V003 microcontroller. \ No newline at end of file diff --git a/firmware/Readme.md b/firmware/Readme.md index bf0ae71..e8f9113 100644 --- a/firmware/Readme.md +++ b/firmware/Readme.md @@ -10,18 +10,21 @@ Below is the guide to set up the build environment, compile, and flash the CH32V ## 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) +Choose `linux-x64` for X86-64 or `linux-arm64` for ARM64. + Extract it: ```bash +cd ~/Downloads 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): ```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 ``` @@ -30,9 +33,24 @@ Verify the installation: 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) Clone the ch32fun repository and build minichlink: ```Bash +cd ~/ git clone https://github.com/cnlohr/ch32fun ~/ch32fun cd ~/ch32fun/minichlink make