Hi there, I've been lurking a while but this is my first post - just want to say I absolutely love Teensy and all the work Paul has done to make this amazing community and product line.
My problem is that I'm trying my best to work outside of the Arduino ecosystem. I am working with a TEENSY41 and managed to get the sample Makefile to compile simple code, with NO_ARDUINO=true set - yay!
My issue is that when I try to compile more complicated code, i.e. a sample I found in these forums that uses MQS (code listed at bottom), I get errors. I'm manually adding in the lib -I args to the CXX command, for Audio, SerialFlash, SPI etc, since those are not in the core. This seems to be what arduino does as well, from what I gathered from some process grepping.
Anyway, I get this error from manually compiling:
I'll note that this compiles fine from arduino. I tried the Makefile from the latest beta too but had the same result. I'm likely doing something stupid here? I'm not ultra familiar with gcc/g++ toolchains, though I'm very willing to learn more.
Code in question:
My problem is that I'm trying my best to work outside of the Arduino ecosystem. I am working with a TEENSY41 and managed to get the sample Makefile to compile simple code, with NO_ARDUINO=true set - yay!
My issue is that when I try to compile more complicated code, i.e. a sample I found in these forums that uses MQS (code listed at bottom), I get errors. I'm manually adding in the lib -I args to the CXX command, for Audio, SerialFlash, SPI etc, since those are not in the core. This seems to be what arduino does as well, from what I gathered from some process grepping.
Anyway, I get this error from manually compiling:
Code:
...
/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: levi.o: in function `AudioOutputMQS::AudioOutputMQS()':
/home/levi/Downloads/arduino-1.8.13/hardware/teensy/avr/libraries/Audio/output_mqs.h:38: undefined reference to `AudioOutputMQS::begin()'
/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: levi.o: in function `AudioStream::AudioStream(unsigned char, audio_block_struct**)':
/home/levi/teensy/helloworld/./AudioStream.h:133: undefined reference to `vtable for AudioSynthToneSweep'
/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: /home/levi/teensy/helloworld/./AudioStream.h:133: undefined reference to `vtable for AudioAmplifier'
/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: /home/levi/teensy/helloworld/./AudioStream.h:133: undefined reference to `vtable for AudioOutputMQS'
I'll note that this compiles fine from arduino. I tried the Makefile from the latest beta too but had the same result. I'm likely doing something stupid here? I'm not ultra familiar with gcc/g++ toolchains, though I'm very willing to learn more.
Code in question:
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthToneSweep tonesweep1; //xy=102,174
AudioAmplifier amp1; //xy=324,172
AudioOutputMQS mqs1; //xy=538,168
AudioConnection patchCord1 (tonesweep1, amp1);
AudioConnection patchCord2 (amp1, 0, mqs1, 0);
// GUItool: end automatically generated code
const float t_ampx = 0.8;
const int t_lox = 10;
const int t_hix = 22000;
const float t_timex = 10; // Length of time for the sweep in seconds
void run(void)
{
// Wait for at least 3 seconds for the USB serial connection
Serial.begin (9600);
while (!Serial && millis () < 3000)
;
delay (3000);
AudioMemory (2);
amp1.gain (0.5);
Serial.println("setup done");
if (!tonesweep1.play (t_ampx, t_lox, t_hix, t_timex)) {
Serial.println ("ToneSweep - play failed");
while (1)
;
}
// wait for the sweep to end
Serial.println ("Tonesweep up started");
while (tonesweep1.isPlaying ())
;
// and now reverse the sweep
Serial.println ("Tonesweep down started");
if (!tonesweep1.play (t_ampx, t_hix, t_lox, t_timex)) {
Serial.println("ToneSweep - play failed");
while (1)
;
}
// wait for the sweep to end
while (tonesweep1.isPlaying ())
;
Serial.println("Done");
}