Skip to content

feat(ci-compile): add --backend={fbuild,platformio} switch - #2409

Merged
zackees merged 1 commit into
masterfrom
feat/compile-backend-switch
Apr 24, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/compile-backend-switch

Conversation

@zackees

@zackees zackees commented Apr 24, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add --backend={fbuild,platformio} (default: fbuild) to bash compile so users can force PlatformIO's native pio run backend instead of fbuild.
  • Convenience aliases: --platformio / --pio == --backend=platformio; --fbuild == --backend=fbuild (default).
  • Needed to investigate and reproduce Teensy 3.0 / LC link-time RAM overflow (.dmabuffers / .bss) across all examples #2406 (teensyLC / teensy30 link-time RAM overflow on fbuild path). Lets anyone compare the two backends side-by-side without editing BOARD_BUILDS_USE_FBUILD.

Why

Previously the board-build backend was hardcoded (BOARD_BUILDS_USE_FBUILD = True in compile_board_examples) with no CLI override. Tracking down #2406 required flipping that constant by hand and rebuilding. The escape hatch also unblocks anyone who needs to keep teensy30/teensyLC green while fbuild upstream fixes land (FastLED/fbuild#204, FastLED/fbuild#205).

Usage:

bash compile teensylc Blink                      # fbuild (unchanged default)
bash compile teensylc Blink --backend=platformio # force pio run
bash compile teensylc Blink --platformio         # same, shorthand
bash compile teensylc Blink --pio                # same, shorter

Changes

  • ci/compiler/argument_parser.py — new BuildBackend enum; three argparse flags (--backend, --platformio/--pio, --fbuild); threads backend through CompilationConfig.
  • ci/compiler/compilation_orchestrator.py — compile_board_examples(..., use_fbuild: Optional[bool] = None) (defaults to BOARD_BUILDS_USE_FBUILD, which is still True); prints the active backend label in the compile banner.
  • ci/ci-compile.py — propagates config.backend through the two CompilationConfig reconstructions and into compile_board_examples.

Default behavior is unchanged: omitting the flag picks fbuild, exactly as before.

Test plan

  • uv run pytest ci/tests/test_fbuild_default_selection.py — passes (existing assertion that default stays fbuild still holds).
  • bash compile teensylc Blink --platformio — successfully builds via pio run (RAM 4164 B / 8192, link OK).
  • uv run ci/ci-compile.py --help — shows the new flags.
  • Manual parse-check of flag precedence:
    • --backend=platformio → platformio
    • --platformio / --pio → platformio
    • --fbuild → fbuild
    • --backend=fbuild --platformio → platformio (shortcut wins, matches last-flag-wins intuition)
  • bash lint ci/compiler/argument_parser.py ci/compiler/compilation_orchestrator.py ci/ci-compile.py — passes.

Related

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added build-backend selection via CLI (--backend plus --platformio/--pio and --fbuild shortcuts), defaulting to fbuild.
    • Compilation now respects the selected backend and indicates which backend (fbuild or PlatformIO) is used during builds, enabling backend-specific behavior for example board builds.

`bash compile` hardcoded fbuild as the board-build backend with no
user-facing knob. Expose a backend selector so PlatformIO's `pio run`
path can be exercised on demand — useful for reproducing
PlatformIO-only size/link behavior and comparing against fbuild output.

Primary flag: --backend={fbuild,platformio} (default: fbuild)
Shortcuts:    --platformio / --pio  ==  --backend=platformio
              --fbuild              ==  --backend=fbuild

Added to motivate and support investigation of #2406,
where fbuild overflows RAM on teensy30/teensyLC but PlatformIO does
not. Upstream fix tracked in FastLED/fbuild#204 and #205.

- ci/compiler/argument_parser.py: add BuildBackend enum, wire flags
  into CompilationConfig.backend.
- ci/compiler/compilation_orchestrator.py: accept optional use_fbuild
  kwarg; log active backend in the compile banner.
- ci/ci-compile.py: propagate config.backend through the two
  CompilationConfig reconstructions and into compile_board_examples.

Existing test_fbuild_default_selection.py continues to pass (default
is unchanged).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 24, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a8e16962-3241-4419-a856-2d094067bc4d

📥 Commits

Reviewing files that changed from the base of the PR and between 0dfcea6 and 2514ce6.

📒 Files selected for processing (3)
  • ci/ci-compile.py
  • ci/compiler/argument_parser.py
  • ci/compiler/compilation_orchestrator.py

📝 Walkthrough

Walkthrough

Threads config.backend into newly created CompilationConfig objects and surfaces a derived use_fbuild boolean into compile_board_examples(...), letting the orchestrator and PioCompiler choose between fbuild and PlatformIO based on CLI/config selection.

Changes

Cohort / File(s) Summary
Argument parsing & config
ci/compiler/argument_parser.py
Add BuildBackend enum (FBUILD, PLATFORMIO); accept --backend and shortcut flags --platformio/--pio, --fbuild; store resolved backend in CompilationConfig.backend (default fbuild).
Config propagation
ci/ci-compile.py
Pass config.backend into newly created CompilationConfig instances for both default and --local paths; derive use_fbuild (true when backend == FBUILD) and forward it to compilation calls.
Orchestration & compiler behavior
ci/compiler/compilation_orchestrator.py
compile_board_examples(..., use_fbuild: Optional[bool]=None) added; prints BUILD BACKEND using resolved value; constructs PioCompiler using the provided use_fbuild instead of the previous constant.

Sequence Diagram

sequenceDiagram
    participant CLI as CLI Arguments
    participant Parser as Argument Parser
    participant Config as CompilationConfig
    participant Main as ci/ci-compile.py
    participant Orch as Compilation Orchestrator
    participant Compiler as PioCompiler

    CLI->>Parser: provide --backend / --platformio / --fbuild
    Parser->>Parser: resolve backend (enum) and shortcuts
    Parser->>Config: create CompilationConfig with backend
    Config-->>Main: return config
    Main->>Main: derive use_fbuild = (config.backend == FBUILD)
    Main->>Orch: call compile_board_examples(..., use_fbuild)
    Orch->>Orch: print "BUILD BACKEND" (fbuild or pio)
    Orch->>Compiler: instantiate with use_fbuild flag
    Compiler-->>Orch: compile using selected backend
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through flags and enums bright,
I threaded backend through the night,
fbuild or pio, a carrot's call,
The orchestrator prints them all.
Compile, dear friends, let builds take flight! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a --backend switch to select between fbuild and platformio backends, which is the core feature of this PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/compile-backend-switch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees
zackees merged commit aa486d6 into master Apr 24, 2026
5 of 7 checks passed
@zackees

zackees commented Apr 25, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Apr 25, 2026

Copy link
Copy Markdown
✅ Actions performed

Full review triggered.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant