Context
FastLED’s Teensy audio support currently detects <Audio.h> and uses Teensy Audio types from the audio-input implementation, but the dependency is not guaranteed to be visible early enough to every build backend’s dependency scanner.
PlatformIO discovers framework libraries through LDF scanning. fbuild uses its own header/dependency selection. If Audio.h is not present in the normal FastLED platform include chain, either backend can omit the Teensy Audio implementation sources even though FastLED’s audio wrappers later reference symbols such as:
AudioInputI2S::begin()
AudioInputI2S2::begin()
AudioInputI2S::update()
vtable for AudioInputI2S
vtable for AudioInputI2S2
This caused the Teensy 4.1 HydroPack link failure tracked by FastLED/FastLED#3685.
The existing include seam is:
src/FastLED.h
src/platforms/ldf_headers.h
src/platforms/arm/teensy/ldf_headers.h
Proposal
Add a Teensy-specific, guarded <Audio.h> include to FastLED’s platform include chain, preferably through platforms/arm/teensy/ldf_headers.h or the adjacent Teensy platform header selected by FastLED.h.
The include should be active when the expected Teensy Audio header is available, so that both dependency systems see it:
- PlatformIO LDF selects the bundled Teensy Audio library.
- fbuild’s header scanner selects and compiles the bundled Audio implementation sources.
This is intentionally a small dependency-discovery shim. It should not manually compile Audio sources, add a broad Teensy framework allowlist, or bypass LTO/section garbage collection. The existing TEENSY_AUDIO_LIBRARY_AVAILABLE guards and no-op behavior for missing headers must remain intact.
Measured baseline
On Teensy 4.1:
| Build |
Flash |
RAM |
| Blink without Audio |
100,352 bytes |
72,352 bytes |
| Blink with Teensy Audio selected |
100,352 bytes |
72,544 bytes |
The Audio-enabled build compiled the bundled Audio sources successfully. Final deployed flash size was unchanged, indicating that LTO/section GC removed unused Audio code. RAM increased by 192 bytes and should be tracked as an explicit cost.
Acceptance criteria
FastLED.h causes the Teensy-specific dependency-discovery path to expose <Audio.h> when the header exists.
- PlatformIO LDF selects the Teensy Audio library for a Teensy sketch that includes only
FastLED.h.
- fbuild selects the same Audio library under the same conditions.
- A Teensy build using
AudioInputI2S and/or AudioInputI2S2 links successfully under both supported build backends.
- A minimal Teensy 4.1 Blink build can include the dependency-discovery shim without increasing deployed flash/HEX size.
- The measured RAM impact is documented and remains within the board budget.
- Missing Teensy Audio headers continue to produce the intended loud warning/no-op behavior rather than a compile failure.
- The change does not restore the old behavior of compiling every unrelated Teensy framework library.
- FastLED CI covers both a minimal Teensy Blink size regression and a Teensy audio consumer such as HydroPack or the existing audio example.
Related issues
Context
FastLED’s Teensy audio support currently detects
<Audio.h>and uses Teensy Audio types from the audio-input implementation, but the dependency is not guaranteed to be visible early enough to every build backend’s dependency scanner.PlatformIO discovers framework libraries through LDF scanning. fbuild uses its own header/dependency selection. If
Audio.his not present in the normal FastLED platform include chain, either backend can omit the Teensy Audio implementation sources even though FastLED’s audio wrappers later reference symbols such as:AudioInputI2S::begin()AudioInputI2S2::begin()AudioInputI2S::update()vtable for AudioInputI2Svtable for AudioInputI2S2This caused the Teensy 4.1 HydroPack link failure tracked by FastLED/FastLED#3685.
The existing include seam is:
src/FastLED.hsrc/platforms/ldf_headers.hsrc/platforms/arm/teensy/ldf_headers.hProposal
Add a Teensy-specific, guarded
<Audio.h>include to FastLED’s platform include chain, preferably throughplatforms/arm/teensy/ldf_headers.hor the adjacent Teensy platform header selected byFastLED.h.The include should be active when the expected Teensy Audio header is available, so that both dependency systems see it:
This is intentionally a small dependency-discovery shim. It should not manually compile Audio sources, add a broad Teensy framework allowlist, or bypass LTO/section garbage collection. The existing
TEENSY_AUDIO_LIBRARY_AVAILABLEguards and no-op behavior for missing headers must remain intact.Measured baseline
On Teensy 4.1:
The Audio-enabled build compiled the bundled Audio sources successfully. Final deployed flash size was unchanged, indicating that LTO/section GC removed unused Audio code. RAM increased by 192 bytes and should be tracked as an explicit cost.
Acceptance criteria
FastLED.hcauses the Teensy-specific dependency-discovery path to expose<Audio.h>when the header exists.FastLED.h.AudioInputI2Sand/orAudioInputI2S2links successfully under both supported build backends.Related issues