Cannot compile a simple example with "attachInterrupt" if optimizations are disabled
Hello. Recently I've bumped into an interesting issue. When I'm trying to completely disable all possible optimizations using -O0 flag, the linker complains that "getPinIndex" is missing. Looks like all teensy 3.x boards are affected even in Teensyduino 1.49.
To reproduce the issue, you can add a new menu option, e.g. for teensy31 board:
And try to compile the following sketch:
You'll see the following error message:
A good blog post about this problem.
Any hints are appreciated. Thanks in advance.
Hello. Recently I've bumped into an interesting issue. When I'm trying to completely disable all possible optimizations using -O0 flag, the linker complains that "getPinIndex" is missing. Looks like all teensy 3.x boards are affected even in Teensyduino 1.49.
To reproduce the issue, you can add a new menu option, e.g. for teensy31 board:
Code:
teensy31.menu.opt.odebug.build.flags.optimize=-O0
And try to compile the following sketch:
Code:
void dummy_cb(){}
void setup() {
attachInterrupt(13, dummy_cb, RISING);
}
void loop() {}
You'll see the following error message:
Code:
C:\Users\User\AppData\Local\Temp\arduino_build_969538/core\core.a(pins_teensy.c.o): In function `attachInterrupt':
E:\IDEs\arduino\hardware\teensy\avr\cores\teensy3/pins_teensy.c:225: undefined reference to `getPinIndex'
A good blog post about this problem.
Any hints are appreciated. Thanks in advance.