Skip to content

feat(fqbn): expand compiler.path to the installed tool that provides the compiler (#1298) - #2233

Merged
zackees merged 1 commit into
mainfrom
agent/1298-toolchain
Dec 1, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/1298-toolchain

Conversation

@zackees

@zackees zackees commented Dec 1, 2026

Copy link
Copy Markdown
Member

What

Follow-up 2's second half of #1298: the toolchain mapping expressed by compiler.path.

An Arduino package does not carry its compiler — it names it by reference, and the compiler lives in a tool installed beside the package. The measured Seeed core is the whole chain in three files:

platform.txt  compiler.path={build.compiler_path}
              compiler.c.cmd={build.crossprefix}gcc
boards.txt    demo.build.compiler_path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
              demo.build.crossprefix=arm-none-eabi-
on disk       <data>/packages/Seeeduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-gcc

fqbn_toolchain::resolve_toolchain (new module, crates/fbuild-build-engine/src/fqbn_toolchain.rs) expands exactly two keys — compiler.path and compiler.c.cmd — over platform.txt overlaid with the board's own properties, and returns the compiler executable plus the tool that provides it. It evaluates no recipe, executes nothing, and touches no network.

Three decisions, each inherited from a rule that already existed rather than invented:

  • The version is never guessed. A versioned {runtime.tools.<tool>.path} (arm-none-eabi-gcc-7-2017q4, how vendor cores pin their toolchain) must name an installed version. A bare name resolves only when exactly one version is installed; several are refused listing them — the same rule as package versions. The Arduino builder publishes both spellings, so both are accepted.
  • Nothing unset is invented. An undefined {…} reference is an error naming it; substituting an empty value would silently compile for another target. Only {runtime.platform.path} and runtime.tools.<tool>.path are expanded here; any other runtime.* property is refused by name.
  • A tool is looked for where the package's own vendor would have installed it first, then across packagers; two packagers installing it is refused, naming both.

fbuild fqbn surfaces it in-band, exactly like the orchestrator claim: toolchain=<name>@<version> + compiler=<path>, or toolchain_error=<reason> beside a still-successful resolution, because the board properties remain the answer. --json carries toolchain {label, compiler, compiler_path, tools[]} or null + toolchain_error.

Real evidence

Published Seeeduino:[email protected] core (34,722,259 B, SHA-256 65d9de0b…fd784f, checksum verified) installed at the canonical <data>/packages/Seeeduino/hardware/mbed/2.9.3/, plus the real x86_64 arm-none-eabi-gcc 7-2017q4 tool (99,857,645 B, index checksum verified, reports 7.2.1 20170904) at <data>/packages/Seeeduino/tools/arm-none-eabi-gcc/7-2017q4/:

$ fbuild fqbn Seeeduino:mbed:xiaonRF52840Plus --arduino-data-dir ./data
toolchain=arm-none-eabi-gcc@7-2017q4
compiler=./data/packages/Seeeduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-gcc

The resolved compiler builds for that board with the board's own flags — arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=softfp -mfpu=fpv4-sp-d16 produced Class: ELF32 / Machine: ARM / Flags: 0x5000000, Version5 EABI.

With the tool directory moved aside, the same query keeps every property and reports:

toolchain_error=config error: FQBN `Seeeduino:mbed:xiaonRF52840Plus`: `compiler.path` needs
tool `arm-none-eabi-gcc-7-2017q4`, which is not installed under
data/packages/Seeeduino/tools (installed versions of arm-none-eabi-gcc: 9-2019q4)

Gates (all run locally, real output)

  • fqbn_toolchain module 17/17; fbuild-build-engine --lib fqbn* 32 passed / 0 failed; fbuild-cli --bin fbuild fqbn 18 passed / 0 failed (4 new CLI tests).
  • RED proved: the cc existence guard disabled → missing_compiler_names_the_expanded_path_and_both_templates FAILED (16 passed / 1 failed, exit 101); restored + touch → 17/17.
  • soldr cargo clippy -p fbuild-build-engine -p fbuild-cli --all-targets -- -D warnings → exit 0, no warnings.
  • soldr cargo fmt --all -- --check → exit 0.
  • uv run ci/enforce_platform_boundary.py --print-totals → rows=0; dylint_rows=0.
  • Both new files are well under the 1000-LOC gate (406 / 330).

Docs updated: docs/design/fqbn-resolution.md ("Follow-up 2b: the toolchain mapping (implemented)" + status + follow-up list) and docs/reference/cli.md (### fbuild fqbn).

Scope

Deliberately not done: fbuild build --fqbn + board_build.fqbn through ResolutionContext (needs this plus the core-named ruling), package-index install, and recipe evaluation (recipe.objcopy.*, recipe.hooks.*).

#1298 stays open — it is the tracking issue for the remaining cells.

…the compiler (#1298)

An Arduino package names its compiler by reference, not by path:
platform.txt sets compiler.path={build.compiler_path} and
compiler.c.cmd={build.crossprefix}gcc, boards.txt points
build.compiler_path at {runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/,
and the tool lives at <data>/packages/<packager>/tools/<name>/<version>.

fqbn_toolchain::resolve_toolchain expands exactly those two keys over
platform.txt overlaid with the board properties, resolves
{runtime.tools.<tool>.path} against installed tools (versioned names pin the
version; a bare name needs exactly one installed version, several are refused
listing them), looks under the package own packager first then across
packagers, and refuses an unset reference instead of substituting an empty
value. The compiler must exist on disk.

fbuild fqbn prints toolchain=<name>@<version> and compiler=<path>, or
toolchain_error=<reason> beside a still-successful resolution, because the
properties remain the answer. --json carries the same pair.

Real run: the published Seeeduino:[email protected] core plus the real x86_64
arm-none-eabi-gcc 7-2017q4 resolves to .../bin/arm-none-eabi-gcc, which builds
an ELF32 ARM object for that board with the board own -mcpu=cortex-m4 flags.

#1298 stays open: build --fqbn, package-index install and recipe evaluation
remain.
@zackees
zackees added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit b68f90b Dec 1, 2026
44 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant