Repository navigation
Description
Edit history: This body was rewritten on 2026-06-14. The first version of this issue claimed the
build_flagspropagation gap was already fixed — that claim was wrong. PR #576's note that "build_flags are not propagated by the nxplpc orchestrator today" is still accurate. The body below reflects the corrected scope. See the comment thread for the original-vs-corrected diff.
Goal
Close the [env:*] build_flags propagation gap in the nxplpc orchestrator's library compile path, then retire the board-JSON workaround #576 installed for lpc845brk (the only LPC variant carrying the stopgap defines today).
Background — what's actually wired vs. broken
The body of #574 (the unified namespaced routing design) called out a concrete bug:
currently nxplpc orchestrator does NOT propagate platformio.ini build_flags — surfaced when LPC845 needed
-DRELEASE/-DFASTLED_DISABLE_DBGto disableFASTLED_FORCE_DBGto fit a JSON-RPC sketch in 64 KB; had to edit the fbuild-config board JSON instead
PR #576 worked around it by baking those defines into lpc845brk.json's extra_flags field — described in #576 as "a stopgap for the missing build_flags propagation".
Code audit pinpoints the gap precisely:
| Path | State |
|---|---|
BuildContext::new reads config.get_build_flags(env_name) into ctx.user_flags |
✅ works (pipeline/context.rs:155) |
Sketch compile chains ctx.user_flags into the overlay |
✅ works (pipeline/sequential.rs:57-67) |
Library compile applies ctx.user_flags to lib_env's c_flags/cpp_flags |
❌ broken — nxplpc/orchestrator.rs:247-257 constructs LibraryBuildEnv with raw compiler.c_flags() / compiler.cpp_flags(), no overlay folded in |
That third row is exactly why PR #576 had to put -DRELEASE=1 -DFASTLED_DISABLE_DBG=1 into the board JSON: the defines need to reach FastLED's library compile (where fl/log/log.h lives) to disable FASTLED_FORCE_DBG. The extra_flags field IS applied to libraries; user build_flags are not.
The fix template — what ESP32 does
crates/fbuild-build/src/esp32/orchestrator/build.rs:423-425:
let p_c_flags = apply_overlay_flags(&p_compiler.c_flags(), &src_overlay, "dummy.c");
let p_cpp_flags = apply_overlay_flags(&p_compiler.cpp_flags(), &src_overlay, "dummy.cpp");
// ... then ...
let lib_env = crate::pipeline::LibraryBuildEnv {
c_flags: &p_c_flags,
cpp_flags: &p_cpp_flags,
// ...
};src_overlay is the combined overlay (incl. ctx.user_flags); apply_overlay_flags folds those into the per-source flag set that ends up on every library compile invocation.
crates/fbuild-build/src/nxplpc/orchestrator.rs:247-257 (current — broken):
let lib_env = pipeline::LibraryBuildEnv {
c_flags: &c_flags, // ← raw compiler flags, no user_flags
cpp_flags: &cpp_flags, // ← same
// ...
};c_flags / cpp_flags here come from compiler.c_flags() / compiler.cpp_flags() directly. The same gap exists in avr/orchestrator.rs:262.
Scope
- Add
user_flagsto LPC library compile. Port the ESP32 pattern: build asrc_overlayoverlib_env's flag inputs, foldctx.user_flagsin viaapply_overlay_flags, store the result in freshVec<String>locals, pointLibraryBuildEnv::c_flags/cpp_flagsat those. - Add a regression-proof test fixture.
tests/platform/lpc845_build_flags/with[env:lpc845brk] build_flags = -DFROM_PLATFORMIO_INI=1and a library source that#errors if the define is missing. One Rust integration test asserts the build succeeds. - THEN drop the stopgap from
lpc845brk.json. Remove-DRELEASE=1 -DFASTLED_DISABLE_DBG=1from theextra_flagsfield. The chip-identification defines (-DLPC845 -DCPU_LPC845M301JBD48 -D__LPC845__ -DARDUINO_LPC845BRK) stay. Note: onlylpc845brk.jsoncarries the stopgap;lpc845.json,lpcxpresso804.json,lpcxpresso845max.jsondo not. - Move those two defines into the consuming sketch's
platformio.iniso they continue to apply where they're wanted. - Post a follow-up comment on PR feat(nxplpc): find_core_root + LPC845 RELEASE defines + pin bump to ACLPC#29 #576 noting the workaround was retired here.
Out of scope
- The broader fbuild: design unified namespaced routing for platform/framework/library artifacts driven by platformio.ini [env:*] #574 design (unified env-namespaced routing across all platforms) — stays in fbuild: design unified namespaced routing for platform/framework/library artifacts driven by platformio.ini [env:*] #574.
- AVR has the identical bug at
avr/orchestrator.rs:262. Track separately if it isn't covered by this PR's scope.
Acceptance
- LPC library compile picks up
[env:*] build_flagsdefines — proven by thelpc845_build_flagsfixture's#errornot firing. -
grep -E '\-DRELEASE|FASTLED_DISABLE_DBG' crates/fbuild-config/assets/boards/json/lpc845brk.jsonreturns no matches. - LPC845-BRK JSON-RPC sketch still links + boots end-to-end with the defines sourced from its own
platformio.ini. - PR feat(nxplpc): find_core_root + LPC845 RELEASE defines + pin bump to ACLPC#29 #576 has a follow-up comment noting the workaround was retired here.
Refs
- #574 — broader namespaced routing design (parent scope)
- #576 — the original workaround
- #586 — LPC845-BRK burn-down meta (this issue is part of section 2)
- Code paths the fix has to touch:
crates/fbuild-build/src/nxplpc/orchestrator.rs:247-257(currentLibraryBuildEnvconstruction — broken)crates/fbuild-build/src/esp32/orchestrator/build.rs:423-425(correct pattern to mirror)crates/fbuild-build/src/pipeline/context.rs:155(whereuser_flagsare populated — already correct)crates/fbuild-build/src/pipeline/sequential.rs:57-67(where the sketch compile already getsuser_flags— also already correct)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
zackees commentedon Jun 14, 2026
Correction — my prior audit was wrong
The body of this issue (and the entry at #586 (comment) announcing it) claimed the
build_flagspropagation gap was already fixed in nxplpc. It is not. I re-checked the code paths directly and PR #576's explicit note — "build_flags are not propagated by the nxplpc orchestrator today" — is still accurate.What I got right vs. wrong
BuildContext::newpopulatesuser_flagsfromconfig.get_build_flags()pipeline/context.rs:155)user_flagsreach the sketch compile viapipeline/sequential.rs:57-67(chained intouser_overlay.common)user_flagsreach the library compile vianxplpc/orchestrator.rs:247constructingLibraryBuildEnvc_flags: &compiler.c_flags()raw, with nouser_flagsoverlay appliedThe library compile path is exactly where
-DRELEASE=1 -DFASTLED_DISABLE_DBG=1need to land for FastLED'sfl/log/log.h(and the rest of the library) to actually disableFASTLED_FORCE_DBG. Until the LPC library compile mirrors the ESP32 fix atesp32/orchestrator/build.rs:423-425, those defines only fire in the sketch translation unit — which is why PR #576 had to bake them intolpc845brk.json'sextra_flagsinstead.The real fix template — what ESP32 does
crates/fbuild-build/src/esp32/orchestrator/build.rs:423-425:src_overlayhere is the combined overlay (incl.ctx.user_flags);apply_overlay_flagsfolds those into the per-source flag set that ends up on every library compile invocation.crates/fbuild-build/src/nxplpc/orchestrator.rs:247-257(current — broken):c_flags/cpp_flagshere come fromcompiler.c_flags()/compiler.cpp_flags()directly —ctx.user_flagsare never folded in. Same bug exists inavr/orchestrator.rs:262.Revised scope for this issue
user_flagsto LPC library compile — port the ESP32 pattern: build asrc_overlayover the lib_env'sc_flags/cpp_flags, foldctx.user_flagsin viaapply_overlay_flags, store the result in freshVec<String>locals, and pointLibraryBuildEnv::c_flags/cpp_flagsat those.tests/platform/lpc845_build_flags/project where[env:lpc845brk] build_flags = -DFROM_PLATFORMIO_INI=1and a library source#errors if the define isn't set. Rust integration test asserts the build succeeds — this is the regression-proof for the bug.lpc845brk.json— remove-DRELEASE=1 -DFASTLED_DISABLE_DBG=1from theextra_flagsfield. Note: it's onlylpc845brk.jsonthat has these defines today;lpc845.json,lpcxpresso804.json,lpcxpresso845max.jsoncarry just chip-identification defines.platformio.iniso they continue to apply where they're actually wanted.avr/orchestrator.rs:262has the identical pattern; track separately if not in scope.Updated acceptance
[env:*] build_flagsdefines — proven by thelpc845_build_flagsfixture's#errornot firinggrep -E '\-DRELEASE|FASTLED_DISABLE_DBG' crates/fbuild-config/assets/boards/json/lpc845brk.jsonreturns no matchesplatformio.iniWhat stays the same
The link to #574 (broader env-namespaced routing design) and #586 (LPC burn-down meta) are unchanged. The cleanup phase (steps 3-4 above) is the same intent the prior body described — the difference is that step 1 is also required, not optional. The empirical sign-off (LPC845-BRK JSON-RPC bringup still working with the defines moved out of board JSON) is the same end-state.
Sorry for the noise — the previous body misled. The fix is a 5-10 line change in the orchestrator plus the test fixture, modeled directly on the ESP32 pattern.
fix(nxplpc): propagate platformio.ini build_flags to library compile (#…
feat(build): EnvNamespace + unified build_flags overlay propagation (#…