Repository navigation
Description
Summary
The uno AVR8JS Test workflow (avr8js_uno_test.yml) is failing on master. Confirmed on CI run https://github.com/FastLED/FastLED/actions/runs/27005282879.
Next group from the README badge sweep after AVR family (#2779/#2780), STM32 GIGA (#2784/#2785), Apollo3 (#2787/#2788), and RP2040 (#2792/#2793).
Failure
The emulator times out after 30s without ever printing Test loop. The captured emulator output is nearly empty:
ERROR: "Test loop" not found in output
This likely indicates the test did not execute properly
The Arduino sketch (examples/Test/Test.ino) is a trivial Serial print:
void setup() {
Serial.begin(115200);
Serial.println("Test setup starting");
delay(100);
}
void loop() {
EVERY_N_MILLIS(1000) { Serial.println("Test loop!"); }
delay(1);
}
Neither "Test setup starting" nor "Test loop!" reaches the emulator output — the firmware is crashing before setup() runs.
Regression bisect
CI history for avr8js_uno_test.yml:
| Commit | Time | Conclusion |
|---|---|---|
c2faf92e0e |
2026-06-04T05:07Z | ✅ success |
| ... | (no AVR8JS runs in the gap) | |
8d1e04e401 |
2026-06-04T17:56Z | ❌ failure (every run since) |
The commit chain between green and first-red contains ca09808b5f — "feat(watchdog): real per-platform hardware impls for ALL platforms (#2731 Phase 2) (#2745)", the same PR responsible for the AVR-family compile breakage closed by #2780.
Root cause
In src/platforms/avr/watchdog_avr.impl.hpp:
__attribute__((used, section(".init3")))
inline void fastled_watchdog_init3() {
sAvrCapturedMcusr = MCUSR;
MCUSR = 0;
wdt_disable();
}
The function is not marked __attribute__((naked)). GCC therefore emits a standard function prologue/epilogue ending in ret. But .init3 hooks are not called — they are just code that the linker concatenates inline between .init2 (BSS clear) and .init4 (data copy). When this function returns:
- Nothing called it, so there is no return address on the stack.
- SP starts at
RAMEND; with no prior push, theretpops two bytes of uninitialized SRAM (or zero, depending on the emulator) and jumps there. - On real hardware that destination is undefined; on avr8js it produces an immediate hang or jump-to-bootloader before
setup()ever runs.
That perfectly matches the symptom — the sketch never reaches its first Serial.println.
The in-source comment justifies omitting naked ("naked functions are not intended to hold ordinary C/C++ statements"), but the avr-libc-canonical pattern for clearing MCUSR + disabling the WDT in .init3 uses naked precisely because of the no-ret requirement:
// avr-libc documentation, "WDT_vect" example
void get_mcusr(void) __attribute__((naked, section(".init3"), used));
void get_mcusr(void) {
mcusr_mirror = MCUSR;
MCUSR = 0;
wdt_disable();
}
MCUSR = 0 and wdt_disable() compile to plain SBI/OUT/inline-asm sequences that don't need a stack frame, so naked is safe here.
Fix
Apply __attribute__((naked)) (in addition to used and section(".init3")) to fastled_watchdog_init3(), and drop the inline keyword (which combines awkwardly with naked). Leave the body untouched — GCC will compile the three statements without prologue/epilogue/ret, letting execution fall through to .init4 as .initN chains require.
Re-justify in the comment block: the previous note warning against naked was based on a general concern about register-allocation fragility, but for the three operations this hook actually performs (no stack temps, no calls, no spills) the avr-libc-canonical naked pattern is correct and safe.
Acceptance criteria
-
uno AVR8JS Testgoes green onmaster. - The Apollo3, STM32, and RP2040 PRs are not regressed (they don't use the AVR watchdog path).
- The classic-AVR boards (uno, attiny85, attiny88, attiny4313) still compile cleanly —
bash compile uno attiny85 attiny88 attiny4313all pass. - Test sketch reaches
setup()andloop()under avr8js.
Out of scope
- Other remaining red badges:
check_esp32_size,check_teensy41_size,unit tests windows. Each will be filed separately. The top-levelbuildaggregate should clear as the underlying workflows go green.
Filed via /loop README badge sweep.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(watchdog/avr): mark .init3 hook __attribute__((naked)) so it fall…