Skip to content

Commit 431eee9

Browse files
zackeesclaude
andcommitted
fix(teensy41): link libarm_cortexM7lfsp_math (CMSIS-DSP)
Closes #257. `Ports/PJRCSpectrumAnalyzer` and any other Teensy Audio FFT example fails to link on teensy41 with: undefined reference to `arm_cfft_radix4_init_q15' undefined reference to `arm_cfft_radix4_q15' These symbols live in `libarm_cortexM7lfsp_math.a`, shipped by the Teensy 4.x core. Teensyduino's `boards.txt` specifies `build.flags.libs=-larm_cortexM7lfsp_math -lm -lstdc++` mandatorily for the platform — it's not example-specific. fbuild's teensy4x.json `linker_libs` was missing the CMSIS-DSP entry. Add `-larm_cortexM7lfsp_math` to the front of the list so it precedes the standard libs (libgcc / libstdc++ / libm / libc). The `-L<core_dir>` search path is already emitted via `LinkerScripts::single(core_dir, ...)` in teensy/orchestrator.rs:244 (the same dir that holds the .ld script also holds the lib), so no additional path config is required. Regression test `teensy4x_links_cmsis_dsp_math` added to `teensy/mcu_config.rs`. Note: the PlatformIO reference JSON for teensy41 (crates/fbuild-build/src/teensy/configs/reference/teensy41.json) also omits this lib — PlatformIO appears to have the same gap. Following Teensyduino's boards.txt rather than PlatformIO's reference is the correct call per the issue analysis. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9f0a0f9 commit 431eee9

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

crates/fbuild-build/src/teensy/configs/teensy4x.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
],
3939

4040
"linker_libs": [
41+
"-larm_cortexM7lfsp_math",
4142
"-lgcc",
4243
"-lstdc++",
4344
"-lm",

crates/fbuild-build/src/teensy/mcu_config.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,26 @@ mod tests {
199199
.contains(&"-mcpu=cortex-m7".to_string()));
200200
}
201201

202+
/// Regression test for issue #257: teensy4x must link
203+
/// `libarm_cortexM7lfsp_math.a` (CMSIS-DSP) so Teensy Audio FFT
204+
/// examples (`Ports/PJRCSpectrumAnalyzer`) resolve symbols like
205+
/// `arm_cfft_radix4_q15`. The library ships in the Teensy 4.x core
206+
/// dir, which the linker already gets as `-L<core_dir>` via
207+
/// `LinkerScripts::single`.
208+
#[test]
209+
fn teensy4x_links_cmsis_dsp_math() {
210+
let config = get_teensy_config_for_mcu("imxrt1062").expect("teensy4x config");
211+
assert!(
212+
config
213+
.linker_libs
214+
.contains(&"-larm_cortexM7lfsp_math".to_string()),
215+
"teensy4x linker_libs must include -larm_cortexM7lfsp_math \
216+
so Teensy Audio FFT examples link; see issue #257. \
217+
Actual libs: {:?}",
218+
config.linker_libs
219+
);
220+
}
221+
202222
#[test]
203223
fn test_teensy_config_for_mcu_mk20dx256() {
204224
let config = get_teensy_config_for_mcu("mk20dx256").expect("teensy3x config");

0 commit comments

Comments
 (0)