Skip to content

samd core is fetched without its submodules (TinyUSB, ZeroDMA) — same class as #1380 #1400

Description

@zackees

Split out of #1380, which fixed the same class of bug for ESP8266 (#1398).

The exposure

adafruit/ArduinoCore-samd is fetched from GitHub's auto-generated source archive:

// crates/fbuild-library/src/library/samd_core.rs
"https://github.com/adafruit/ArduinoCore-samd/archive/refs/tags/1.7.16.tar.gz"

Those archives omit submodules by design. That tag declares two, both under libraries/:

path = libraries/Adafruit_TinyUSB_Arduino
path = libraries/Adafruit_ZeroDMA

So a sketch including a TinyUSB or ZeroDMA header should fail the same way ESP8266's <LittleFS.h> did — inside the core's own tree, with the directory present and empty, and with __has_include still passing so no consumer-side guard catches it.

Why it is not a copy of the ESP8266 fix

ESP8266 was easy because the project publishes a release asset that bundles submodule contents (esp8266-3.1.2.zip). Adafruit publishes no release assets for 1.7.16:

$ gh release view 1.7.16 --repo adafruit/ArduinoCore-samd --json assets -q '.assets[] | .name'
(empty)

So the options are different, and each needs its own verification:

  1. Submodule-aware fetchgit clone --recurse-submodules at the tag. Changes the package fetch path from "download + extract archive" to "clone", which PackageBase does not currently do.
  2. Vendor-published bundle — Adafruit's Arduino package index (package_adafruit_index.json) points at a prepared core archive; PlatformIO consumes something equivalent. Needs checking whether that artifact actually contains the submodule contents.
  3. Post-unpack sanity checkESP8266 core cached without the littlefs submodule; any <LittleFS.h> include fails #1380's other suggestion: after extracting a core, verify its declared library headers resolve. Cheap to detect an empty submodule directory at package time; expensive to diagnose at compile time. This is the generalizable one and would have caught ESP8266 too.

Not yet confirmed

I have not reproduced a samd build failure. The reasoning is by analogy with the confirmed ESP8266 case plus the .gitmodules contents at the pinned tag. Someone should verify a TinyUSB-including sketch actually breaks before picking a fix — it is possible those libraries are unused by fbuild's samd builds, in which case this is latent rather than active.

Also worth a look

SiliconLabs/arduino@2.2.0 declares one submodule, extra/core-api. It does publish a release asset (silabs_arduino_core-2.2.0.zst). Whether extra/core-api is on any include path is unknown — I did not check.

Cores confirmed clean

ArduinoCore-avr, ArduinoCore-mbed, ArduinoCore-API, ATTinyCore — no .gitmodules at their pinned tags.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions