chipaudette
Well-known member
I've got a library that compiles fine under Teensy 3.6 but won't compile until Teensy 4.0. It's giving errors about not knowing F_CPU_ACTUAL. I suspect that this is a symptom of a larger problem, but I don't know how to chase it down. Why would I get compile errors for Teensy 4 but not for Teensy 3?
More Info...
My library is a float32 extension of the teensy audio library (https://github.com/Tympan/Tympan_Library), which means that most of its classes inherit (after a couple steps) from AudioStream from the Teensy Audio library.
The simplest way to expose this problem is to simply open the PassThroughStereo example from the Teensy Audio library. It compiles fine as either Teensy 3.6 or Teensy 4.0.
Now, to cause the error, I add the #include referencing my own library...not any actual code, just the #include:
This complies fine under Teensy 3.6. But, under Teensy 4, I get the error below for (seemingly) every class that inherits from AudioStream...it claims that it does't know about F_CPU_ACTUAL:
Similarly, I also get the error below for many (all?) of the files that inherit from AudioStream...it claims that it doesn't know IRQ_SOFTWARE:
Why would this compile fine under Teensy 3.6 but break under Teensy 4.0?
Thanks,
Chip
More Info...
My library is a float32 extension of the teensy audio library (https://github.com/Tympan/Tympan_Library), which means that most of its classes inherit (after a couple steps) from AudioStream from the Teensy Audio library.
The simplest way to expose this problem is to simply open the PassThroughStereo example from the Teensy Audio library. It compiles fine as either Teensy 3.6 or Teensy 4.0.
Now, to cause the error, I add the #include referencing my own library...not any actual code, just the #include:
Code:
//This is the beginning of PassThroughStereo.ino
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <Tympan_Library.h> //I added this. I don't instantiate any classes. I just added this #include.
This complies fine under Teensy 3.6. But, under Teensy 4, I get the error below for (seemingly) every class that inherits from AudioStream...it claims that it does't know about F_CPU_ACTUAL:
Code:
In file included from C:\Users\wea\Documents\Arduino\libraries\Tympan_Library\src\AudioStream_F32.h:18:0,
from C:\Users\wea\Documents\Arduino\libraries\Tympan_Library\src\AudioMixer_F32.h:21,
from C:\Users\wea\Documents\Arduino\libraries\Tympan_Library\src\AudioMixer_F32.cpp:1:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h: In member function 'int AudioStream::processorUsage()':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h:108:50: error: 'F_CPU_ACTUAL' was not declared in this scope
#define CYCLE_COUNTER_APPROX_PERCENT(n) (((n) + (F_CPU_ACTUAL / 32 / AUDIO_SAMPLE_RATE * AUDIO_BLOCK_SAMPLES / 100)) / (F_CPU_ACTUAL / 16 / AUDIO_SAMPLE_RATE * AUDIO_BLOCK_SAMPLES / 100))
Similarly, I also get the error below for many (all?) of the files that inherit from AudioStream...it claims that it doesn't know IRQ_SOFTWARE:
Code:
In file included from C:\Users\wea\Documents\Arduino\libraries\Tympan_Library\src\AudioStream_F32.h:18:0,
from C:\Users\wea\Documents\Arduino\libraries\Tympan_Library\src\AudioMixer_F32.h:21,
from C:\Users\wea\Documents\Arduino\libraries\Tympan_Library\src\AudioMixer_F32.cpp:1:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h: In static member function 'static void AudioStream::update_all()':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h:162:50: error: 'IRQ_SOFTWARE' was not declared in this scope
static void update_all(void) { NVIC_SET_PENDING(IRQ_SOFTWARE); }
^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h:162:62: error: 'NVIC_SET_PENDING' was not declared in this scope
static void update_all(void) { NVIC_SET_PENDING(IRQ_SOFTWARE); }
Why would this compile fine under Teensy 3.6 but break under Teensy 4.0?
Thanks,
Chip