Skip to content

CH32V003 hardware bring-up: validate the existing CH32V pipeline on real silicon #1208

Description

@zackees

Summary

A physical CH32V003 is now on the bench. fbuild's CH32V support was built out across #1102/#1130 and is green in CI, but every bit of it has only ever been validated by a compile job — no firmware from this repo has been proven to run on real silicon. This issue is the step-by-step bring-up: take the existing paper support to a verified blink, then close the remaining gaps that only show up with hardware attached.

The FastLED-side platform port is tracked separately in FastLED/FastLED — see the companion issue linked below. This issue stops at "fbuild can build, flash, and talk to a CH32V003."

What already exists (do not rebuild)

Layer Location State
Platform::Ch32v crates/fbuild-core/src/lib.rs:128, :169 done
RISC-V toolchain crates/fbuild-toolchain/src/toolchain/riscv.rs — xPack riscv-none-elf-gcc 14.2.0-3, per-host SHA-256 table done
Arduino core crates/fbuild-library/src/library/ch32v_core.rs — OpenWCH arduino_core_ch32 1.0.4+d767162.ch32l103 done
MCU config crates/fbuild-build-mcu/src/ch32v/configs/ch32v003.json done
Orchestrator / compiler / linker crates/fbuild-build-mcu/src/ch32v/ done
Board JSONs crates/fbuild-config/assets/boards/json/genericCH32V003*.json (+13 more CH32) done
Deployers crates/fbuild-deploy/src/wlink.rs (pinned wlink v0.1.2), wchisp.rs done, never run against hardware
Deploy dispatch crates/fbuild-daemon/src/handlers/operations/deploy.rs:809-825 done
Test project tests/platform/ch32v003/ done
CI .github/workflows/build-ch32v003.yml from ci/board_families.json:31 green

Verified board record (genericCH32V003F4P6.json): march: rv32ec_zicsr, mabi: ilp32e, f_cpu: 48000000L, rom 16384, ram 2048, upload.protocol: wch-link.

Known gaps

  1. No hardware validation of any of the above. Primary purpose of this issue.
  2. WCH-LinkE has no USB identity. 1A86:8010 (RV mode) / 1A86:8012 (DAP mode) are absent from the FastLED/boards registry. Per CLAUDE.md these must not be added to this repo — the fix is a PR to FastLED/boards, ingested at runtime via fbuild_core::usb::profiles::profiles_for. Today crates/fbuild-serial/src/boards.rs:613 (test-only table) would wildcard 0x1A86 to Esp32ExternalUart, which is wrong for a probe.
  3. No probe-rs support. probe_rs.rs:358 map_board_to_probe_rs_chip() handles only lpc845. Upstream probe-rs does not support CH32 either (probe-rs#28), so this is likely permanent — wlink is the path.
  4. Framework locked to arduino. orchestrator.rs:260 validate_ch32v_framework() rejects noneos-sdk and ch32v003fun even though the board JSON advertises them (ch32v: framework field is ignored — noneos-sdk envs silently build the OpenWCH Arduino core (4 of 9 CI envs affected) #1108).
  5. No debug. crates/fbuild-cli/src/cli/debug.rs:131Platform::Ch32v => DebugSupport::Injected.
  6. No emulator. No QEMU rv32; infer_default_emulator_kind returns None for ch32v.
  7. minichlink referenced in board JSON upload.protocols but not implemented.

Hardware

  • Target: CH32V003F4P6 — RV32EC @ 48 MHz, 16 KB flash / 2 KB SRAM, no hardware multiply, single-wire debug (SWIO), no USB peripheral.
  • Programmer: WCH-LinkE (1A86:8010 RV mode). wchisp is not usablewchisp.rs:152 supports_mcu() correctly excludes V003/V006, which have no factory USB-ISP bootloader (fix(boards): drop 'isp' protocol from CH32V003/CH32V006 board JSONs - parts have no reachable ISP bootloader #1125).
  • At time of filing, no VID_1A86 device is enumerated on the bench machine. There is one Unknown USB Device (Device Descriptor Request Failed) at VID_0000&PID_0002 — rule this out (cable/port/hub) as step 0.

Step-by-step

Phase 0 — Establish the probe

  • Confirm the WCH-LinkE enumerates as 1A86:8010. If it comes up as 1A86:8012 (DAP mode), hold the button while plugging in to toggle to RV mode.
  • Windows: bind WinUSB to the probe interface via Zadig if wlink can't claim it. Record the exact procedure — this is the single most common first-time failure and belongs in the docs.
  • wlink status sees the chip and reports the correct flash size. Record the WCH-Link firmware version (wlink v0.1.2 is tested against 2.15).
  • Wire SWIO / GND / 3V3 to the target and confirm the chip ID reads back.

Exit criteria: wlink status prints a CH32V003 chip ID.

Phase 1 — Build

Exit criteria: a .bin under 16384 bytes.

Phase 2 — First flash (the actual bring-up)

  • soldr cargo run -p fbuild-cli -- deploy tests/platform/ch32v003 -e ch32v003 (defaults to the wlink deployer).
  • Confirm ensure_wlink_installed() downloads and checksum-verifies the pinned v0.1.2 asset into ~/.fbuild/{prod|dev}/tools/wlink/.
  • Observe the blink on a scope or LED. This is the first time fbuild firmware has ever executed on this architecture — a successful flash is not sufficient evidence.
  • Verify the 48 MHz clock empirically (toggle a pin in a known-cycle loop and measure), rather than trusting the define.

Exit criteria: measured blink at the expected rate. This is the bring-up milestone.

Phase 3 — Close the hardware-visible gaps

  • FastLED/boards PR adding 1A86:8010 and 1A86:8012 with purpose: probe / role: debug-probe. Then re-verify fbuild serial probe list classifies the WCH-LinkE as a probe and not as an ESP32 UART bridge. Do not patch fbuild-serial tables.
  • Decide and document the SDI-print / serial story. V003 has no USB, so console output is either SDI-print over the debug link (wlink supports it) or a USART pin to a separate bridge. Whichever is chosen, fbuild serial needs to know about it.
  • Add a DTR/RTS matrix row for the WCH-LinkE CDC interface in docs/usb-cdc-control-line-matrix.md.
  • Fix boards.rs:613's (0x1A86, _) wildcard so a probe isn't misclassified.

Phase 4 — Harden

  • Add a #[ignore = "requires CH32V003 + WCH-LinkE probe"] hardware integration test covering build → flash → verify.
  • Update docs/BOARD_STATUS.md: CH32V003 moves from compile-verified to hardware-verified, with the bench setup documented.
  • Write up the Zadig/WinUSB procedure and probe-mode toggle in the CH32V README.
  • Consider bumping the xPack toolchain to 14.3.0-1 or 15.2.0-1 (both 2025-10-23) — only if Phase 1/2 surface a codegen problem. Not part of bring-up.

Out of scope (file separately if wanted)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions