Repository navigation
Closed
Labels
area: coreLED drivers, color math, animationsplatform: avrArduino Uno, Mega, ATtinystatus: staleNo activity for 60+ daysstatus: triageNeeds initial assessment
Description
This section of code will never run
Lines 28 to 60 in 42441aa
| #elif SCALE8_AVRASM == 1 | |
| #if defined(LIB8_ATTINY) | |
| #if (FASTLED_SCALE8_FIXED == 1) | |
| uint8_t work=i; | |
| #else | |
| uint8_t work=0; | |
| #endif | |
| uint8_t cnt=0x80; | |
| asm volatile( | |
| #if (FASTLED_SCALE8_FIXED == 1) | |
| " inc %[scale] \n\t" | |
| " breq DONE_%= \n\t" | |
| " clr %[work] \n\t" | |
| #endif | |
| "LOOP_%=: \n\t" | |
| /*" sbrc %[scale], 0 \n\t" | |
| " add %[work], %[i] \n\t" | |
| " ror %[work] \n\t" | |
| " lsr %[scale] \n\t" | |
| " clc \n\t"*/ | |
| " sbrc %[scale], 0 \n\t" | |
| " add %[work], %[i] \n\t" | |
| " ror %[work] \n\t" | |
| " lsr %[scale] \n\t" | |
| " lsr %[cnt] \n\t" | |
| "brcc LOOP_%= \n\t" | |
| "DONE_%=: \n\t" | |
| : [work] "+r" (work), [cnt] "+r" (cnt) | |
| : [scale] "r" (scale), [i] "r" (i) | |
| : | |
| ); | |
| return work; | |
| #else |
as
SCALE8_AVRASM can only equal 1 when LIB8_ATTINY is undefined.Lines 245 to 253 in 42441aa
| #if !defined(LIB8_ATTINY) | |
| #define SCALE8_C 0 | |
| #define SCALE16BY8_C 0 | |
| #define SCALE16_C 0 | |
| #define MUL8_C 0 | |
| #define QMUL8_C 0 | |
| #define EASE8_C 0 | |
| #define BLEND8_C 0 | |
| #define SCALE8_AVRASM 1 |
Metadata
Metadata
Assignees
Labels
area: coreLED drivers, color math, animationsplatform: avrArduino Uno, Mega, ATtinystatus: staleNo activity for 60+ daysstatus: triageNeeds initial assessment
Type
Projects
- StatusShow more project fieldsDone
Activity
kriegsman commentedon Jan 29, 2020
Oops. Good catch. Thank you.
zackees commentedon Jun 3, 2026
Tracked in FastLED/fbuild#389 for AVR / megaAVR / ATtiny fbuild platform/build support validation.
That fbuild issue is scoped to board metadata, toolchain/backend support, and FastLED smoke-build evidence. Any remaining FastLED source/platform-code blocker should stay linked from both sides.
zackees commentedon Jun 3, 2026
fbuild build-system status update (tracker: FastLED/fbuild#389)
This is a FastLED-side macro-guard issue, not a build-tool issue. fbuild has no fbuild-side gap to track here. The bug is the logical inconsistency between
LIB8_ATTINYandSCALE8_AVRASMinlib8tion.h/lib8tion/scale8.h.Cross-linked from FastLED/fbuild#389 for completeness.
zackees commentedon Aug 2, 2026
Fixed. Closing after verifying against current master.
The bug you reported was real. In
42441aa,lib8tion.hsetSCALE8_AVRASM = 1only in the#ifndef LIB8_ATTINYarm, whilelib8tion/scale8.hguarded its ATtiny shift-and-add assembly with#elif SCALE8_AVRASM == 1→#if defined(LIB8_ATTINY). Those two conditions were mutually exclusive, so that inner block was unreachable and ATtiny silently fell through to the plain C multiply. Good catch, and @kriegsman agreed at the time.It is fixed now, by restructure rather than by patching the guard.
LIB8_ATTINYno longer exists anywhere in the tree —grep -rn 'LIB8_ATTINY\|SCALE8_AVRASM' src/findsSCALE8_AVRASMonly as a config macro, andLIB8_ATTINYnot at all. What replaced it:Detection moved to a dedicated header.
src/platforms/avr/is_avr.hdefinesFL_IS_AVR_ATTINY(plusFL_IS_AVR_ATTINY_MODERN,_TINY_MEMORY,_NO_UART).Dispatch happens before the macros are read.
src/platforms/scale8.h:10-23picks the implementation header up front:The shift-and-add routine from your report now lives at
scale8_attiny.h:28— the samesbrc/add/ror/lsr/brccloop, verbatim — and it is the onlyscale8()compiled on ATtiny.The config macros are now mutually exclusive by construction.
src/platforms/math8_config.hsetsSCALE8_C=1, SCALE8_AVRASM=0underFL_IS_AVR_ATTINYand the exact inverse otherwise. The remaining#if SCALE8_C == 1 / #elif SCALE8_AVRASM == 1 / #else #errorchains inplatforms/scale8.htherefore have no dead arm — and the#errorfallback makes a future regression a build failure rather than silence.Verified on hardware config, not just by reading:
bash compile attiny85 --examples Blinksucceeds (3.37KB / 8KB flash, 411 / 512 bytes RAM), and disassembling the resulting ELF withavr-objdump -dyields zeromulinstructions — which is the definitive check, since the whole point of the ATtiny branch is that the part has no hardware multiplier. The MUL-basedSCALE8_AVRASMcode is provably not in the binary.Re @zackees' notes above: agreed this was a FastLED-side macro-guard issue with no fbuild component, and FastLED/fbuild#389 can stand on its own for AVR/megaAVR/ATtiny build validation.
Thanks for the precise report — a permalink to the exact unreachable lines is the ideal way to file this kind of thing.