Repository navigation
feat(fqbn): build a vendor core end to end -- core, libraries, sketch, link, images (#1298) - #2251
Merged
Merged
Conversation
The FQBN path could resolve a board, expand any recipe, compile a unit,
archive, link, convert the ELF and flash it -- one step per invocation,
with the caller carrying every intermediate file. This is the conductor:
`fbuild fqbn <FQBN> --sketch <dir>/<dir>.ino --build <DIR>` walks the
package's own stages in Arduino's order -- core, archive, libraries,
sketch, link, objcopy -- and stops at the first failure naming it.
- new `fqbn_build` (engine): `plan_build` is data (one CompileUnit per
source, the core archive, the link, the images, the hooks) and `build`
is the only spawner, so the composition is testable without a toolchain.
- objects mirror their sources under `build.path` (`core/`, `core/variant/`,
`libraries/<name>/`, `sketch/`); every recipe still expands
`{build.path}` to the one build root, which `plan_unit_in` now carries
explicitly (`plan_unit` keeps its inferred form, so no caller changes).
- library selection is `fqbn_libraries::plan_for_sketch`, sketch
preprocessing is the shared `source_scanner`, archive/link/prelink hooks
are `fqbn_link` -- no rule is re-derived here.
- hook stages run: prebuild, libraries.prebuild, sketch.prebuild,
linking.prelink (in the link), linking.postlink, postbuild. A package
that declares a hook in any other stage is refused by key, because
silently skipping a stage is firmware the vendor did not describe.
- `plan_archive_pending` / `plan_link_pending` exist because a build plans
its objects before it compiles them; the single-step planners still
require their inputs to exist.
Real e2e, no fixtures:
- arduino:[email protected] (installed from the published index) Blink:
25 core units -> core.a 353,796 B -> ELF 14,208 B -> .eep 13 B, .hex 2,611 B.
- the same AVR board with real FastLED 3.10.10 from a `--library-root`:
38 library units, ELF 61,864 B, .hex 10,126 B.
- the issue's motivating target, Seeeduino:[email protected]
`xiaonRF52840Plus`: 42 core units, core.a 27,637,612 B, ELF 1,732,744 B,
.bin 84,632 B, .hex 238,115 B, and the package's `nrfutil` .zip 85,441 B
(that last step needs the vendor's pip tool on PATH, as its own
post_install.sh arranges).
Gates: engine lib 752 passed / 0 failed / 6 ignored (10 new), cli 602
passed / 0 failed (4 new), clippy -D warnings exit 0, Windows MSVC clippy
and macOS aarch64 check exit 0, boundary rows=0; dylint_rows=0, research
--check exit 0, fmt clean. RED twice: dropping the explicit build.path
fails the build-root test, dropping the library include wiring fails the
include-dir test.
6 tasks
…2251) `dylint / Rust lint` refused `source.as_path().starts_with(variant.as_path())` in `plan_core_units` (`ban_raw_path_prefix_compare`, #952): a raw prefix comparison compares components as written, so a canonicalized vs raw spelling would silently place a variant object under the core tree. `relative_to` is the workspace's ancestry test and returns the same answer for the same spelling. Engine 752/0/6 after the change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The FQBN path could resolve a board, expand any recipe, compile a unit, archive, link, convert the ELF and flash it — one step per invocation, with the caller carrying every intermediate file. This is the conductor that walks those same steps in Arduino's order and hands each one the output of the one before.
What it does
plan_buildis data,buildis the only spawner — the same split every other step here uses, so the whole composition is testable without a toolchain on any host.build.path:core/<rel>.o,core/variant/<rel>.o,libraries/<name>/<rel>.o,sketch/<name>.ino.cpp.oplus the sketch's own non-.inosources (top level andsrc/).{build.path}to the one build root.plan_unit_incarries that root explicitly (a unit living incore/used to infer its own directory);plan_unitkeeps the inferred behaviour, so no existing caller or test changes.fqbn_libraries::plan_for_sketch, sketch preprocessing is the sharedsource_scannerthroughfqbn_compile, archive/link/pre-link hooks arefqbn_link— no rule is re-derived here.prebuild,libraries.prebuild,sketch.prebuild,linking.prelink(inside the link),linking.postlink,postbuild, numeric order within a stage. A package that declares a hook in any other stage (core.prebuild,objcopy.*,savehex.*) is refused by key: silently skipping a stage is firmware the vendor did not describe.plan_archive_pending/plan_link_pendingexist because a build plans its objects before it compiles them; the single-step planners still require their inputs to exist, so the CLI's--archive/--linkkeep refusing a missing object.<dir>/<dir>.ino, and unresolved sketch includes are reported, not refused (the compiler stays the authority over toolchain headers).Real e2e (no fixtures)
arduino:[email protected]Blinkcore.a353,796 B → ELF 14,208 B →.eep13 B,.hex2,611 B, exit 0--library-root.hex10,126 B, exit 0Seeeduino:[email protected]xiaonRF52840Plus(the issue's motivating target)core.a27,637,612 B → ELF 1,732,744 B →.bin84,632 B,.hex238,115 B,.zip85,441 B, exit 0The mbed run also exercised the package's own pre-link hook (
-E -Pof the variant linker script intobuild.path) and itsnrfutilpackaging recipe; that last step needs the vendor'sadafruit-nrfutilon PATH, exactly as the core's ownpost_install.sharranges.Gates
-D warningsexit 0; Windows MSVC clippy and macOS aarch64 check exit 0rows=0; dylint_rows=0; research--checkexit 0;cargo fmt --checkcleanbuild.pathfails the build-root test; dropping the library include wiring fails the include-dir test#1298 stays open — this closes the build-driver cell; the issue's surface/open-question list still gets its receipt.