fix(teensy): auto-link Teensyduino CMSIS-DSP per-MCU (#300)#313
Conversation
Mirrors PlatformIO+Teensyduino's SCons builder, which auto-appends the
right libarm_cortex*_math.a to the link command based on MCU. Without
this, FastLED's Ports/PJRCSpectrumAnalyzer (and any Teensy sketch using
Audio.h FFT classes) failed at link with undefined references to
arm_cfft_radix4_q15 / arm_cfft_radix4_init_q15.
Data-driven via a new build.cmsis_dsp_lib field on the board JSONs,
surfaced as BoardConfig.cmsis_dsp_lib and threaded into TeensyLinker.
The bundled archive ships inside the Teensyduino toolchain
(framework-arduinoteensy.../cores/teensy*/), which the linker already
gets via -L<core_dir> through LinkerScripts::single — no extra search
path or download is needed.
Per-MCU mapping populated on the JSONs:
MK20DX128/256 (3.0, 3.1, 3.2) -> arm_cortexM4l_math
MK64FX512 (3.5), MK66FX1M0 (3.6) -> arm_cortexM4lf_math
MKL26Z64 (LC) -> arm_cortexM0l_math
IMXRT1062 (4.0, 4.1, MicroMod) -> arm_cortexM7lfsp_math
The previously-hardcoded -larm_cortexM7lfsp_math entry in
teensy4x.json's mcu config linker_libs is removed; the same library is
now contributed via the data-driven path so teensy40/41/mm all share
the same mechanism as the 3.x family.
Tests:
- fbuild-config: every ARM Teensy board carries the expected
cmsis_dsp_lib, AVR Teensy 2.0/2pp omit it, non-Teensy boards omit
it, env overrides win over the bundled value
- fbuild-build: teensy36 build_link_args() includes
-larm_cortexM4lf_math and -L<core_dir>; the flag is absent when no
lib is configured; mcu_config-level test now asserts each ARM
Teensy board declares its expected library
Refs #300, #257.
|
Warning Review limit reached
More reviews will be available in 46 minutes and 57 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (16)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ror (#316) `build_link_args` was added by #313 (CMSIS-DSP auto-link refactor) but a hold-over from #305 still referenced `output_dir.join("firmware.map")`, which doesn't exist as a parameter of `build_link_args` (it takes `elf_path: &Path`, not `output_dir`). The workspace failed to compile with: error[E0425]: cannot find value `output_dir` in this scope --> crates/fbuild-build/src/teensy/teensy_linker.rs:93:24 Every PR opened against main since #313 has been red because of this. Derive the map path from `elf_path.with_extension("map")`, which is equivalent to `output_dir.join("firmware.map")` since `elf_path = output_dir.join("firmware.elf")` at the only call site. Adds `test_teensy_link_command_emits_linker_map_next_to_elf` so the regression is caught locally next time. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Data-driven CMSIS-DSP auto-link for Teensy 3.x / 4.x / LC / MM, mirroring PlatformIO+Teensyduino's per-MCU matrix. Adds optional
build.cmsis_dsp_libfield to the board JSON schema, surfaces it asBoardConfig.cmsis_dsp_lib, and hasTeensyLinkerappend-l<lib>aftermcu_config.linker_libs. Resolves via the existing-L<core_dir>so the Teensyduino-bundledlibarm_cortex*_math.ais found without extra downloads.arm_cortexM4l_matharm_cortexM4lf_matharm_cortexM0l_matharm_cortexM7lfsp_mathUnblocks FastLED's
Ports/PJRCSpectrumAnalyzerexample on Teensy 3.x/4.x.Closes #300.
Test plan
teensy_boards_carry_cmsis_dsp_libdata-driven test asserts every ARM Teensy board's JSON valuesoldr cargo check/clippy --workspace --all-targets -- -D warningscleanRUSTDOCFLAGS="-D warnings" soldr cargo doc --workspace --no-depsclean./test— no failures🤖 Generated with Claude Code