Install
Prerequisites
- A supported board — see Hardware.
- An ST-Link V2 (or compatible) SWD probe.
- Linux host with
gcc-arm-none-eabi,cmake,ninja-build,openocd. - A bench supply or a charger you are willing to brick.
1. Install host dependencies
sudo apt install gcc-arm-none-eabi cmake ninja-build openocd 2. Clone
git clone https://github.com/RAR/OpenEVCharger
cd OpenEVCharger 3. Fetch the GD32F20x SPL
The vendor library is not redistributable. See third_party/GD32F20x_Firmware_Library/README.md for the source URL and where to drop the archive.
4. Configure and build
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/arm-none-eabi-toolchain.cmake -G Ninja
ninja -C build 5. Back up the stock firmware
./tools/stock_backup.sh 6. Flash
./tools/flash.sh 7. First boot
The MCU boots to SELF_TEST, runs ADC sanity / relay-open /
CP-floor / GFCI CAL checks, then transitions to READY. The
debug UART prints a timestamped log; the LED ring shows steady green
when ready.
Recovery
If anything goes wrong, hold the recovery jumper (see recovery/ in the firmware repo) and re-flash from the stock dump captured in step 5.