Repository navigation
feat(fqbn): expand compiler.path to the installed tool that provides the compiler (#1298) - #2233
Merged
Merged
Conversation
…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.
6 tasks
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 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:
fqbn_toolchain::resolve_toolchain(new module,crates/fbuild-build-engine/src/fqbn_toolchain.rs) expands exactly two keys —compiler.pathandcompiler.c.cmd— overplatform.txtoverlaid 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:
{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.{…}reference is an error naming it; substituting an empty value would silently compile for another target. Only{runtime.platform.path}andruntime.tools.<tool>.pathare expanded here; any otherruntime.*property is refused by name.fbuild fqbnsurfaces it in-band, exactly like the orchestrator claim:toolchain=<name>@<version>+compiler=<path>, ortoolchain_error=<reason>beside a still-successful resolution, because the board properties remain the answer.--jsoncarriestoolchain {label, compiler, compiler_path, tools[]}ornull+toolchain_error.Real evidence
Published
Seeeduino:[email protected]core (34,722,259 B, SHA-25665d9de0b…fd784f, checksum verified) installed at the canonical<data>/packages/Seeeduino/hardware/mbed/2.9.3/, plus the real x86_64arm-none-eabi-gcc 7-2017q4tool (99,857,645 B, index checksum verified, reports7.2.1 20170904) at<data>/packages/Seeeduino/tools/arm-none-eabi-gcc/7-2017q4/: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-d16producedClass: ELF32 / Machine: ARM / Flags: 0x5000000, Version5 EABI.With the tool directory moved aside, the same query keeps every property and reports:
Gates (all run locally, real output)
fqbn_toolchainmodule 17/17;fbuild-build-engine --lib fqbn*32 passed / 0 failed;fbuild-cli --bin fbuild fqbn18 passed / 0 failed (4 new CLI tests).ccexistence guard disabled →missing_compiler_names_the_expanded_path_and_both_templatesFAILED (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.Docs updated:
docs/design/fqbn-resolution.md("Follow-up 2b: the toolchain mapping (implemented)" + status + follow-up list) anddocs/reference/cli.md(### fbuild fqbn).Scope
Deliberately not done:
fbuild build --fqbn+board_build.fqbnthroughResolutionContext(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.