The syntax is without the - sign:
Code:#pragma GCC optimize ("O2")
Thank you for your detailed explanations. It is very informative and interesting !
I played a bit with that, and got the following error:
Code:Arduino: 1.0.6 + Td: 1.21-test1 (Windows 7), Board: "Teensy 3.1" C:\Arduino\hardware\tools\arm\bin\arm-none-eabi-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mcpu=cortex-m4 -DF_CPU=96000000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -mthumb -nostdlib -D__MK20DX256__ -DTEENSYDUINO=120 -fno-rtti -felide-constructors -std=gnu++0x -DUSB_RAWHID -DLAYOUT_US_ENGLISH -Os -IC:\Arduino\hardware\teensy\cores\teensy3 -IC:\Arduino\libraries\Audio -IC:\Arduino\libraries\Wire -IC:\Arduino\libraries\SPI -IC:\Arduino\libraries\SD C:\Users\Frank\AppData\Local\Temp\build3217826331405170921.tmp\WavFilePlayer.cpp -o C:\Users\Frank\AppData\Local\Temp\build3217826331405170921.tmp\WavFilePlayer.cpp.o In file included from C:\Arduino\libraries\Audio/Audio.h:37:0, from WavFilePlayer.ino:11: C:\Arduino\hardware\teensy\cores\teensy3/DMAChannel.h: In member function 'void DMAChannel::attachInterrupt(void (*)())': C:\Arduino\hardware\teensy\cores\teensy3/DMAChannel.h:480:43: error: invalid conversion from 'void (*)()' to 'void (*)()' [-fpermissive] _VectorsRam[channel + IRQ_DMA_CH0 + 16] = isr; ^
This occurs, when #pragma GCC optimize ("O2") is used as the very first line of the sketch. I stripped it down to the following:
Code:#pragma GCC optimize ("O2") #include <Audio.h> #include <Wire.h> #include <SPI.h> #include <SD.h> void setup() { } void loop() { }
invalid conversion from 'void (*)()' to 'void (*)()' sounds a bit strange...
Note when i use -O2 as parameter instead, all is ok.
I get then same message "invalid conversion from 'void (*)()' to 'void (*)()'" in my own code at a place where i use a function pointer to set an entry in the vectorTable when using this pragma.
Edit:The Table is: void (* _VectorsRam[NVIC_NUM_INTERRUPTS+16])(void);
The function is: void func(void)
p.s. i know the "hot" functions of the codecs, but that are nearly all... ;-). thats why i tried pragma.
I will try __attribute__ now.
Last edited: