Teensy 4.1 Blink Sketch Doesn't Run if Optimize = "Smallest Code" (-Os)

visual_micro

Active member
Teensy Board Package v1.58.1
Affects: Arduino IDE, Visual Micro

Summary:
After uploading the Blink Sketch to a Standard Teensy 4.1, the LED does not blink.

This is only found when using the "Smallest Code" Optimization, all other Optimization levels work as expected.

Code:
Code:
// Teensy Board Package v1.58.1
// Board Options:
//		- USBType: Serial
//		- CPU Speed: 600Mhz
//		- Optimize: Smallest Code
//		- Keyboard Layout: US English

// Compiling with "Smallest Code" -Os - LED Doesnt blink
// Faster: OK
// Debug: OK
// Fast: OK
// Fastest: OK

void setup() {
	pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
	digitalWrite(LED_BUILTIN, HIGH);
	delay(500);
	digitalWrite(LED_BUILTIN, LOW);
	delay(500);
}
 
Works fine for me with Optimize Smallest Code ...and with LTO.
I'm also using Visual Micro with Visual Studio.
Using Teensyduino vs 1.59b3 with Arduino 1.18.19
 
Last edited:
Thanks, we will tell the user to upgrade. Are you using Teensyduino install to 1.8 or board manager package?

Teensyduino 1.59b3 installed on to of Arduino 1.8.19 (oops my poor old eyes I saw and posted Arduino 1.18.19 instead of 1.8.19 before, sorry)
 
Back
Top