Issue |
128536
|
Summary |
[AVR] clang: Arduino program breaks when Serial functions are used
|
Labels |
clang
|
Assignees |
|
Reporter |
dakkshesh07
|
**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):
```cpp
#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):
```cpp
#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](https://github.com/ClangBuiltArduino/core_arduino_avr/tree/9602bbb2523eedbe1e8c7459659e3eb00781b000/cores/arduino)
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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs