Repository navigation
ci(pio): make -fopt-info-all opt-in per board (default OFF) - #2659
Conversation
Today every non-AVR / non-esp32c2 board unconditionally gets `-fopt-info-all=<board>/optimization_report.txt` injected by ci/compiler/pio.py. The flag is APPEND-mode and writes a single file shared across every example in the matrix — for slow-link (no-LTO) boards with a large example set (nrf52840 + Adafruit BSP: ~110 examples × ~25-96 source files × hundreds of opt-info lines per TU) the file routinely exceeds 100 MB. When build_template.yml's Optimization Report step then dumps that file to the GitHub Actions log via `ci/optimization_report.py --first`, the per-step log buffer overruns and the runner is killed mid-step, masking already-successful builds. PR #2658 capped the log-side dump at 1 MiB as a stop-gap; this PR closes the source-side hole by making the GCC flag itself opt-in. Changes: - Add `Board.generate_optimization_report: bool = False` (default OFF) - ci/compiler/pio.py only injects `-fopt-info-all=...` when the board opts in (and still respects the esp32c2 / atmelavr suppression) - The linker map (`-Wl,-Map,firmware.map`) stays unconditional — it's a small per-example file and is consumed by size-analysis tooling Behavior for the Optimization Report workflow step is unchanged for opted-in boards. For non-opted-in boards the report file simply doesn't exist; `ci/optimization_report.py --first` already handles that case gracefully (prints a "No optimization report found" message and exits 0). Boards that need the report for size/perf debugging can opt in by adding `generate_optimization_report=True` to their `Board(...)` definition in ci/boards.py. Refs PR #2658. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR introduces an opt-in mechanism for GCC optimization report generation in the build system. A new boolean field ChangesOptimization Report Opt-In
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Summary
ci/compiler/pio.pycurrently injects-fopt-info-all=<board>/optimization_report.txtfor every board (except esp32c2 + atmelavr) unconditionally. The flag is APPEND-mode and writes to a single per-board file shared across every example in the matrix.build_template.yml's Optimization Report step then dumps that file to the GHA log viaci/optimization_report.py --first, the per-step log buffer overruns and the runner gets shutdown mid-step. That's the root cause of the nrf52840 "build succeeds but workflow marked failure" pattern. PR ci(optimization-report): cap stdout dump at 1 MiB to keep GHA runner alive #2658 capped the log-side dump at 1 MiB as a stop-gap; this PR closes the source-side hole.Changes
Board.generate_optimization_report: bool = False(default OFF).ci/compiler/pio.pyonly adds the-fopt-info-all=...flag when the board opts in (and still respects the existing esp32c2 / atmelavr suppression).-Wl,-Map,firmware.map) stays unconditional — it's a small per-example file and is consumed by size-analysis tooling.Behavior preservation
ci/optimization_report.py --firstalready handles that case gracefully (printsNo optimization report found for board '<name>'and exits 0). No workflow change needed.generate_optimization_report=Trueon theBoard(...)definition.Why no board is opted in by default
The only consumer of
optimization_report.txtis the workflow's display step — no automated tooling processes it. Boards that genuinely need optimizer notes for debugging can opt in selectively (one example doesn't trigger the >100MB overrun; a per-board single-sketch CI does).Test plan
Board(...)defaults togenerate_optimization_report=False;Board(..., generate_optimization_report=True)round-trips correctly.🤖 Generated with Claude Code
Summary by CodeRabbit