-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Closed
Labels
Description
LLVM Version: 20.1.0-rc2
Description:
I'm trying to compile Arduino AVR programs using Clang, but I’ve encountered an issue with the Blink example sketch. When Serial functions are used, the LED remains stuck in the ON position, even with LTO disabled globally. Removing the serial-related code allows the LED to blink normally.
Test Code:
Failing Example (LED stuck ON):
#include <Arduino.h>
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(9600);
Serial.println();
Serial.println("Hello world. I was built with clang!");
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}Working Example (without Serial functions):
#include <Arduino.h>
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}Additional Info:
- The same code works correctly when compiled with AVR GCC.
- The Arduino AVR core fork used during compilation: ClangBuiltArduino/core_arduino_avr
Please let me know if any additional information would be helpful for diagnosing this issue — I can provide assembly files, compiler flags, or any other relevant details as needed.