Repository navigation
feat(fqbn): plan the package's own upload step (#1298) - #2249
Merged
Merged
Conversation
The Arduino chain ends with a flash step that is not a build recipe:
`tools.<tool>.upload.pattern`, selected by the board's `upload.tool.<protocol>`
(falling back to `upload.tool.default`, then `upload.tool`).
- `fqbn_upload` plans the command for an image and a caller-named port:
`{serial.port}` is never defaulted, `{upload.verbose}` is the package's
`upload.params.<level>`, `{upload.verify}` its declared (possibly empty)
value, and the image must exist and must not be the ELF.
- Tool-scoped `{…}` references (`{cmd.path}`, `{config.path}`, `{path}`)
resolve inside `tools.<tool>.` — the real AVR core names its uploader that
way — with the package-wide map consulted first and an unresolvable
reference refused by name and namespace.
- The "command must name the file you asked for" rule is containment with
path-character bounds, because the flasher receives the image inside a larger
argument (`-Uflash:w:<path>.hex:i`); a recipe naming another file is refused.
- CLI `fbuild fqbn --upload <image> --port <port> [--protocol <p>]
[--upload-verbose] [--run]`, text and JSON; `--run` spawns the uploader and
reports its exit code, with no retry.
Real e2e on `arduino:[email protected]` (published index, checksums verified): 25 core
units -> core.a 353,404 B -> sketch TU 3,916 B -> Blink.elf 14,200 B ->
Blink.hex 2,611 B + Blink.eep 13 B -> `--upload` plans the real avrdude
command; `--run` on a nonexistent port exits 1 with avrdude's own
`ser_open(): can't open device` message.
#1298 stays open (library discovery and `fbuild build --fqbn` remain).
This was referenced Dec 4, 2026
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.
What
Follow-up 4g of #1298: the last step of the Arduino builder — handing a firmware
image to the package's own uploader.
boards.txtnames it (uno.upload.tool=avrdude,upload.tool.default,upload.tool.network=arduino_ota),platform.txtspells the command:tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} {upload.verify} -p{build.mcu} -c{upload.protocol} "-P{serial.port}" -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i".fbuild fqbn <FQBN> --upload <image> --port <port> [--protocol <p>] [--upload-verbose] [--run]plans it;--runis the only thing that spawns.Decisions (each a refusal, not a guess)
upload.tool.<protocol>when a protocol is named, elseupload.tool.default, elseupload.tool; a board declaring none is refusedwith the keys it could declare.
{serial.port}is never defaulted — a plan for a device thecaller did not name is a command line nobody can audit.
{upload.verbose}istools.<tool>.upload.params.<level>;{upload.verify}istools.<tool>.upload.verify, which the AVR core declares empty.{cmd.path}/{config.path}/{path}aresiblings in
tools.<tool>., not package-wide properties. Expansion consultsthe package map first, then falls back to
tools.<tool>.<name>, and refusesan unresolvable reference by name and namespace.
(
-Uflash:w:<path>.hex:i), so the check is containment bounded bypath-characters, not argument equality — and a recipe naming another file is
still refused.
verdict, with no retry (a half-flashed board must be re-flashed deliberately).
Real e2e (
arduino:[email protected]from the published index)25 core units →
core.a353,404 B → sketch TU 3,916 B →Blink.elf14,200 B →--objcopy→Blink.hex2,611 B +Blink.eep13 B →--upload:--runagainst a nonexistent port spawns the real avrdude and reports its ownfailure (
upload_exit=1,avrdude: ser_open(): can't open device …). No boardwas flashed.
--protocol networkon this package selectsarduino_otaand isrefused by name for
{upload.port.address}— the honest outcome, since nothingdeclares it.
Gates (real output)
soldr cargo test -p fbuild-build-engine --lib: 730 passed / 0 failed / 6 ignoredsoldr cargo test -p fbuild-cli --bin fbuild: 594 passed / 0 failedclippy -p fbuild-build-engine -p fbuild-cli --all-targets -- -D warnings: exit 0cargo fmt --all: clean; boundaryrows=0; dylint_rows=0containment check neutered → the "names another image" test passes when it
must fail.
Docs:
docs/design/fqbn-resolution.md(status, follow-up 4g, remaining cells),docs/reference/cli.md, engine README.#1298 stays open: library discovery and
fbuild build --fqbnremain.