Skip to content

ci: detect compiler-flag drift between fbuild and PlatformIO across all platforms #2410

Open

Description

@zackees

Background

PR #2395 made fbuild the default for board builds. While unifying on one backend is the goal, fbuild has been silently drifting from PlatformIO in ways that have already broken at least one platform (Teensy 4.x) and likely affect others we haven't caught yet.

Concrete example: Teensy 4.x drift discovered 2026-04-25

After commit cafcfb3493 ("chore(ci): add teensy40/41 to fbuild") landed on 2026-04-18, every single teensy41 master CI run has failed (50+ consecutive failures). The teensy30/31/LC builds — which kept using PlatformIO — continued going green throughout the same window.

The actual error from the latest run (24914626788):

colorpalettes.h:23:35: error: 'RainbowColors_p' causes a section type
                              conflict with 'fl::sinCosPairedLut'

This is a real GCC .progmem section-attribute conflict (mismatched alignment between two PROGMEM tables). It only surfaced under fbuild, never under PlatformIO, despite identical source, identical unity-build entry files, and the same arm-none-eabi-gcc toolchain.

Flag drift comparison (Teensy 4.x)

Comparing PlatformIO's actual build_info_Blink.json for teensy41 vs fbuild's reference config for teensy4x:

Flag/Define PlatformIO fbuild
-fpermissive yes no
-Wno-error=narrowing yes no
-flto=auto -fno-fat-lto-objects no yes
-Os (release) no (uses -O2) yes
-Wextra no yes
Define CORE_TEENSY yes no
Define F_CPU=600000000 yes no
Define PLATFORMIO=60118 yes no
Define ARDUINO_ARCH_TEENSY no yes
ARDUINO= value 10805 10819

-flto=auto -fno-fat-lto-objects is the most likely culprit for the Teensy 4.x section-conflict: with fat-LTO disabled, code generation defers to link time and section-attribute consolidation runs through a different GCC code path.

Open question

How much drift exists for every other platform we ship? We don't know — there is no programmatic check.

Proposal

Add a workflow that, for every supported board, compares the actual compile command line fbuild uses against the compile command line PlatformIO would use for the same translation unit, and fails CI if the two diverge (or at least posts a diff on the PR for visual review).

Approach sketch:

  1. For each board in boards.py, produce two compile_commands.json files:
    • One from a real PlatformIO pio run -t compiledb invocation
    • One from fbuild's existing compile_commands.json emission
  2. Normalize both (sort flags, strip absolute paths, strip cache-key salts).
  3. Diff per-source-file. Allow an explicit allowlist of intentional differences.
  4. Run nightly (or on-PR for ci/** and boards.py changes) and post the diff as a workflow summary.

This should be doable for all build types since both backends end up invoking the same toolchain — the difference is purely in the argv they pass.

Acceptance criteria

  • CI job that emits a per-board flag-drift report
  • Configurable allowlist for intentional fbuild-only / PlatformIO-only flags
  • Drift report attached as workflow artifact + posted to PR if changed
  • Initial run audits all boards currently in FBUILD_BOARDS and produces a baseline

Related

  • Discovered while investigating uncommitted Teensy 4.x PROGMEM workaround on branch pr-2395
  • Sibling issue: standardized cross-backend smoke tests (filing separately)
  • Sibling issue: extend comparison to arduino-cli for three-way drift detection (filing separately)

Activity

  1. added
    status: triage
    type: feature
    priority: high
    area: ci
    on Apr 25, 2026
  2. added
    deferred
    on Aug 20, 2026
  3. zackees commented on Aug 20, 2026

    @zackees
    MemberAuthor

    Deferred after a current-master audit. PRs #2801 and #3155 provide a useful Teensy 4.0 detector, but the issue still requires all-board coverage, an intentional-drift allowlist, PR-facing changed-result reporting, and an all-board baseline. This is a cross-platform CI program rather than a bounded bug fix. Resume when an owner can supply/maintain backend snapshots across the supported board matrix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: cideferredpriority: highstatus: triagetype: feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions