Skip to content

chore(ch32v): patch_backup_header is a silent no-op against the pinned core; obsolete test + redundant X035 define #1127

Description

@zackees

Severity: MEDIUM (latent) — patch_backup_header is a silent no-op against the pinned core; its unit test pins obsolete behavior; a related orchestrator define is now redundant.

Problem

crates/fbuild-library/src/library/ch32v_core.rs:197-228 string-replaces #ifndef CH32V00x in the downloaded core's backup.h. At the pinned commit (d767162), that file's guard is now:

#if !defined(CH32V00x) && !defined(CH32VM00X) && !(CH32X035)

so the replacement never fires (verified against the pinned file). It happens to be benign today because upstream now guards V00x/VM00X/X035 itself — but:

  1. The unit test test_patch_backup_header_replaces_old_guard green-lights dead behavior (it feeds the function the old header text, which the pinned core no longer contains).
  2. The X035 workaround define RCC_BackupResetCmd(x)=((void)0) in crates/fbuild-build-mcu/src/ch32v/orchestrator.rs:129-131 is now redundant (upstream's guard excludes X035 already).
  3. A patch that silently does nothing when its pattern is missing will hide the next core-pin bump's real breakage.

Fix direction

Either delete the patch + redundant define + obsolete test (preferred, since upstream fixed the guard), or make the patch return an error when its pattern is absent so a core-pin bump surfaces the drift. Verify the ch32v003/ch32x035 test envs still build after removal.

Acceptance

  • tests/platform/ch32v003 and tests/platform/ch32x035 build with the patch removed.
  • No test asserts on behavior the pinned core can't trigger.

From the 2026-07-21 CH32V bench-readiness sweep.

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