From 57c398b385bfc2e8e77447bd65ce6ba0b76f2451 Mon Sep 17 00:00:00 2001 From: zackees Date: Tue, 30 Jun 2026 10:10:32 -0700 Subject: [PATCH] fix(samd): wire platform_packages override (#677) Follows #664 / #681 / #870. SAMD is the half-migration left over from #870: `samd_core.rs` already grew `with_override`, but the call site in `install_samd_core` was still calling `SamdCores::new` unconditionally. Resolve `framework-arduino-samd-adafruit` at the SAM/SAMD outer call site (fbuild ships Adafruit's `ArduinoCore-samd`, so this is the matching PIO package name; PIO also has `framework-arduino-samd` for Arduino MKR/Zero and `framework-arduino-samd-seeed` for Seeeduino, but those aren't variants fbuild currently builds). Thread the override through `install_samd_core` alongside the existing `install_sam_core` override threading. Closes #677 --- crates/fbuild-build/src/sam/orchestrator.rs | 23 +++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/fbuild-build/src/sam/orchestrator.rs b/crates/fbuild-build/src/sam/orchestrator.rs index 959595fa..82c7a123 100644 --- a/crates/fbuild-build/src/sam/orchestrator.rs +++ b/crates/fbuild-build/src/sam/orchestrator.rs @@ -98,6 +98,10 @@ impl BuildOrchestrator for SamOrchestrator { // Honor `platform_packages` override (FastLED/fbuild#664, #681). Only // SAM (Due) is wired through this PR — SAMD's framework_name needs // separate verification (see issue thread). + // FastLED/fbuild#664, #681: honor `platform_packages` override per + // framework. SAMD (Adafruit ArduinoCore-samd) and SAM (Arduino + // ArduinoCore-sam) are distinct PIO packages, so resolve both + // overrides and route to the branch that runs. let __sam_ovr = ctx .config .get_env_config(¶ms.env_name) @@ -105,9 +109,18 @@ impl BuildOrchestrator for SamOrchestrator { .and_then(|env| { crate::package_override::resolve_override(env, "framework-arduino-sam") }); + // FastLED/fbuild#677: fbuild ships Adafruit's `ArduinoCore-samd`, + // so the matching PIO package name is `framework-arduino-samd-adafruit`. + let __samd_ovr = ctx + .config + .get_env_config(¶ms.env_name) + .ok() + .and_then(|env| { + crate::package_override::resolve_override(env, "framework-arduino-samd-adafruit") + }); let (framework_dir, core_dir, variant_dir, linker_script_path, system_includes) = if is_samd_mcu(&ctx.board.mcu) { - install_samd_core(params, &ctx.board.core, &ctx.board.variant).await? + install_samd_core(params, &ctx.board.core, &ctx.board.variant, __samd_ovr).await? } else { install_sam_core(params, &ctx.board.core, &ctx.board.variant, __sam_ovr).await? }; @@ -357,8 +370,14 @@ async fn install_samd_core( params: &BuildParams, core_name: &str, variant_name: &str, + override_: Option, ) -> Result<(PathBuf, PathBuf, PathBuf, PathBuf, Vec)> { - let framework = fbuild_packages::library::SamdCores::new(¶ms.project_dir); + let framework = match override_ { + Some(o) => { + fbuild_packages::library::SamdCores::with_override(¶ms.project_dir, o) + } + None => fbuild_packages::library::SamdCores::new(¶ms.project_dir), + }; let framework_dir = fbuild_packages::Package::ensure_installed(&framework).await?; tracing::info!("SAMD cores at {}", framework_dir.display());