Failed attempt at Setting up Arduino WCH support in VM

2026-09-18

Takeaway: don’t ever buy or use their stuff again.

welp, who knows this cute little RISC-V board can be such a pain in the ass? I didn’t but anyways here’s how I tried to set up the arduino-cli with it.

Pre-requisites

Grab any VM that has a linux kernel, as I’m writing this I’m using debian.

Need a VM for this because the software requires a proprietary and custom openOCD, and doesn’t even follow UNIX FHS standards.

Install arduino-cli

Set up cores

Following the official docs,

Add the 3rd party core

open up config at ~/.arduino15/arduino-cli.yaml, add the link here:

board_manager:
  additional_urls:
    - https://github.com/openwch/board_manager_files/raw/main/package_ch32v_index.json

It’s also possible to version lock this by downloading this index locally and use it instead. The repo hasn’t been updated for one year now, I don’t suppose anything would change. [1]

run the arduino-cli core update-index again, then search with: arduino-cli core search wch.

WCH:ch32v should appear and use arduino-cli core install wch:ch32v

note the lower case here

Then it will install an extremely ancient version of gcc :) and compiling should work at this stage.

Compilation

First check out what board you are using with arduino-cli board listall, arduino-cli board list won’t work tho. :)

Then, attach it:

arduino-cli board attach -p /dev/ttyACM0 -b WCH:ch32v:CH32X035_EVT

Again, notice this goofy ahh case :)

Deps

Now it should say missing some library file. Of course, since it’s a proprietary custom build of openocd and they can’t even bother statically link their stuff :)

basically copy their pre-built libraries to /usr/lib (which doesn’t follow FHS of course) (which will break your other applications using these libraries, and a update will break them all) by executing their shell script: [2]

cd ~/.arduino15/packages/WCH/tools/beforeinstall/1.0.0
./start.sh

go back and it should work now, yay!

cd -

arduino-cli compile -u

… except not, because upload will fail with an obscure reason:

Sketch uses 4956 bytes (7%) of program storage space. Maximum is 63488 bytes.
Global variables use 524 bytes (2%) of dynamic memory, leaving 19956 bytes for local variables. Maximum is 20480 bytes.
Open On-Chip Debugger 0.11.0+dev-02415-gfad123a16-dirty (2023-10-11-14:01)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'sdi'
Warn : Transport "sdi" was already selected
Ready for Remote Connections
Error: open failed

I tried to edit the udev permission, but nothing succeeded. I’m not sure if it’s a VM problem or not.

At this point I’ve completely gave up, I genuinely can’t believe how they managed to deliver such a terrible experience with pre-existing toolchains, and their github issue page is now filled with unfortunate MacOS users who can’t even make libusb work.

  1. https://docs.arduino.cc/arduino-cli/getting-started/#adding-3rd-party-cores ↩

  2. https://github.com/openwch/arduino_core_ch32#linux ↩


< Fearless Firefox CTRL-WPlaying Old Minecraft JAVA on Linux >