Repository navigation
Fix Digispark ATtiny85 Blink build - #2386
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a Digispark ATtiny85 board entry and marks it tiny-memory; replaces the previous two-argument Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
src/platforms/avr/attiny/clockless_blocking.h (1)
15-16: Duplicate include.
fl/stl/compiler_control.his included twice back-to-back. Drop the redundant line.Proposed fix
`#include` "fl/stl/compiler_control.h" -#include "fl/stl/compiler_control.h" `#include` "fl/system/fastpin.h"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/platforms/avr/attiny/clockless_blocking.h` around lines 15 - 16, Remove the duplicate include of "fl/stl/compiler_control.h" in clockless_blocking.h: keep a single `#include` "fl/stl/compiler_control.h" and delete the redundant consecutive include so the header is only included once.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/build_digispark_tiny.yml:
- Around line 11-20: The workflow's paths filter is missing third_party/** so
changes under third_party (e.g., third_party/cq_kernel/kiss_fft.h) won't trigger
the job; update the paths list in the .github/workflows/build_digispark_tiny.yml
workflow (the paths: array entries) to include 'third_party/**' in both
occurrences (the first paths block shown and the second block around lines
24-33) so edits under third_party will run the workflow.
In `@ci/boards.py`:
- Around line 1066-1071: The DIGISPARK_TINY Board lacks platform_packages
pinning so CI may use newer toolchains; update the DIGISPARK_TINY Board
definition to include a platform_packages entry that pins the Digistump core and
AVR toolchain to the legacy versions cited (e.g., Digistump core ~1.6.7 and
toolchain-atmelavr matching avr-gcc 4.8.1), referencing the DIGISPARK_TINY Board
symbol and Board class to locate the definition; alternatively, if you prefer
not to pin here, add explicit assertions in the Digispark CI workflow to check
installed platform/package versions and fail the job if the legacy versions are
not present.
In `@src/cpp_compat.h`:
- Line 16: The fallback macro redefinition of static_assert must be guarded to
avoid "macro redefined" warnings; update the code around the static_assert
definition to check for an existing macro (use `#ifdef` or `#if`
defined(static_assert)) and `#undef` it before providing your fallback, then
proceed to define static_assert as intended so that any prior toolchain-provided
macro is safely cleared first.
In `@src/platforms/avr/attiny/clockless_blocking.h`:
- Around line 489-492: Do not override the existing FastLED compiler macro;
remove the unconditional `#undef FL_FALLTHROUGH` and the GCC-only `#define
FL_FALLTHROUGH __attribute__ ((fallthrough));` in `clockless_blocking.h` and
instead rely on the existing definition from `src/fl/stl/compiler_control.h` (or
include that header if not already included). Specifically, restore use of the
FastLED `FL_FALLTHROUGH` macro (which handles compiler/version differences),
remove the trailing semicolon from any attribute-style defines, and apply the
same fix in `clockless_blocking_controller.h` where `FL_FALLTHROUGH` is
similarly redefined.
---
Nitpick comments:
In `@src/platforms/avr/attiny/clockless_blocking.h`:
- Around line 15-16: Remove the duplicate include of "fl/stl/compiler_control.h"
in clockless_blocking.h: keep a single `#include` "fl/stl/compiler_control.h" and
delete the redundant consecutive include so the header is only included once.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 144120d2-377a-401e-8bf2-100474949ff3
📒 Files selected for processing (10)
.github/workflows/build_digispark_tiny.ymlci/boards.pysrc/cpp_compat.hsrc/fl/gfx/colorutils.cpp.hppsrc/fl/gfx/colorutils.hsrc/platforms/adafruit/clockless.cpp.hppsrc/platforms/arduino/io_arduino.hppsrc/platforms/avr/attiny/clockless_blocking.hsrc/third_party/cq_kernel/kiss_fft.htests/fl/gfx/colorutils.cpp
💤 Files with no reviewable changes (1)
- src/third_party/cq_kernel/kiss_fft.h
7f4fd1c to
2025933
Compare
📊 Header Compilation PerformanceTotal Time: 1149.32ms Top 5 Slowest Headers
Warnings
Full Report |
There was a problem hiding this comment.
♻️ Duplicate comments (2)
ci/boards.py (1)
1066-1071:⚠️ Potential issue | 🟡 MinorStill verify the legacy Digispark package versions used by CI.
DIGISPARK_TINYstill relies on PlatformIO defaults, so the Blink job may pass with newer packages while missing the avr-gcc 4.8.1 / Digistump 1.6.7 acceptance target from the issue. This was already flagged in an earlier review; resolve by pinningplatform_packageshere or asserting installed package versions in the Digispark workflow.#!/bin/bash # Description: Check whether Digispark CI now pins or asserts the legacy Digistump core/toolchain versions. # Expected: DIGISPARK_TINY has platform_packages for the targeted packages, or workflow/CI code asserts avr-gcc 4.8.1 and Digistump core 1.6.7. rg -n -C4 'DIGISPARK_TINY|digispark-tiny|platform_packages|toolchain-atmelavr|framework-arduino.*digistump|1\.6\.7|4\.8\.1' ci .github platformio.ini🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ci/boards.py` around lines 1066 - 1071, DIGISPARK_TINY currently relies on PlatformIO defaults and doesn't pin the legacy Digispark toolchain/core versions; update the DIGISPARK_TINY Board definition to include explicit platform_packages entries (e.g., pin toolchain-atmelavr@=4.8.1 and the Digistump core/package@=1.6.7) in the Board(...) initializer or alternatively add an assertion step in the Digispark CI workflow that checks installed package versions (avr-gcc 4.8.1 and Digistump core 1.6.7) before running the Blink job; modify the DIGISPARK_TINY symbol in ci/boards.py (the Board(...) instantiation) or the Digispark workflow to implement one of these fixes.src/cpp_compat.h (1)
36-42:⚠️ Potential issue | 🟠 MajorClear any existing
static_assertmacro before redefining it.This still risks a macro-redefinition diagnostic on toolchains/headers that already provide
static_assertas a macro, which is one of the PR’s target failures. Guard and undefine it immediately before the fallback definition.Proposed fix
+#ifdef static_assert +#undef static_assert +#endif `#define` static_assert(...) \ FL_STATIC_ASSERT_SELECT(__VA_ARGS__, FL_STATIC_ASSERT_10, \ FL_STATIC_ASSERT_9, FL_STATIC_ASSERT_8, \ FL_STATIC_ASSERT_7, FL_STATIC_ASSERT_6, \ FL_STATIC_ASSERT_5, FL_STATIC_ASSERT_4, \ FL_STATIC_ASSERT_3, FL_STATIC_ASSERT_2) \ (__VA_ARGS__)To verify the guard is present in the current branch:
#!/bin/bash # Description: Inspect the static_assert fallback definition and verify it undefines any prior macro first. # Expected: An `#ifdef/`#if defined(static_assert) guard followed by `#undef` static_assert before `#define` static_assert(...). sed -n '9,45p' src/cpp_compat.h rg -n -C3 '^\s*#\s*(ifdef|if\s+defined\(|undef|define)\s+static_assert\b|^\s*#\s*define\s+static_assert\s*\(' src/cpp_compat.h🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cpp_compat.h` around lines 36 - 42, The fallback static_assert macro can trigger macro-redefinition diagnostics if an existing static_assert macro exists; before defining static_assert, add a preprocessor check and undef: use `#if` defined(static_assert) or `#ifdef` static_assert to `#undef` static_assert, then proceed to `#define` static_assert(...) as currently implemented (the FL_STATIC_ASSERT_SELECT(...) invocation and FL_STATIC_ASSERT_2..10 symbols remain unchanged) so the new fallback always replaces any prior macro safely.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@ci/boards.py`:
- Around line 1066-1071: DIGISPARK_TINY currently relies on PlatformIO defaults
and doesn't pin the legacy Digispark toolchain/core versions; update the
DIGISPARK_TINY Board definition to include explicit platform_packages entries
(e.g., pin toolchain-atmelavr@=4.8.1 and the Digistump core/package@=1.6.7) in
the Board(...) initializer or alternatively add an assertion step in the
Digispark CI workflow that checks installed package versions (avr-gcc 4.8.1 and
Digistump core 1.6.7) before running the Blink job; modify the DIGISPARK_TINY
symbol in ci/boards.py (the Board(...) instantiation) or the Digispark workflow
to implement one of these fixes.
In `@src/cpp_compat.h`:
- Around line 36-42: The fallback static_assert macro can trigger
macro-redefinition diagnostics if an existing static_assert macro exists; before
defining static_assert, add a preprocessor check and undef: use `#if`
defined(static_assert) or `#ifdef` static_assert to `#undef` static_assert, then
proceed to `#define` static_assert(...) as currently implemented (the
FL_STATIC_ASSERT_SELECT(...) invocation and FL_STATIC_ASSERT_2..10 symbols
remain unchanged) so the new fallback always replaces any prior macro safely.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6f8c4c28-000f-4173-96ba-bbe00f9e5ac4
📒 Files selected for processing (9)
ci/boards.pysrc/cpp_compat.hsrc/fl/gfx/colorutils.cpp.hppsrc/fl/gfx/colorutils.hsrc/platforms/adafruit/clockless.cpp.hppsrc/platforms/arduino/io_arduino.hppsrc/platforms/avr/attiny/clockless_blocking.hsrc/third_party/cq_kernel/kiss_fft.htests/fl/gfx/colorutils.cpp
💤 Files with no reviewable changes (1)
- src/third_party/cq_kernel/kiss_fft.h
✅ Files skipped from review due to trivial changes (2)
- src/platforms/avr/attiny/clockless_blocking.h
- src/fl/gfx/colorutils.cpp.hpp
🚧 Files skipped from review as they are similar to previous changes (2)
- src/platforms/adafruit/clockless.cpp.hpp
- src/fl/gfx/colorutils.h
2025933 to
dbdcb73
Compare
📊 Header Compilation PerformanceTotal Time: 1003.83ms Top 5 Slowest Headers
Warnings
Full Report |
dbdcb73 to
c12e15a
Compare
📊 Header Compilation PerformanceTotal Time: 1279.52ms Top 5 Slowest Headers
Warnings
Full Report |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/cpp_compat.h`:
- Around line 24-34: The current FL_STATIC_ASSERT_* dispatcher reconstructs the
expression via FL_STATIC_ASSERT_IMPL((__VA_ARGS__)), which turns
template-argument commas into the comma operator and silently miscompiles
predicates like fl::is_same<T,U>::value; to fix, collapse the dispatcher so
callers only get the 2-argument form: have the public dispatcher macro map all
forms to FL_STATIC_ASSERT_2 (remove or undefine
FL_STATIC_ASSERT_3..FL_STATIC_ASSERT_10) and add a clear header comment on
FL_STATIC_ASSERT_2/FL_STATIC_ASSERT_IMPL documenting that template-comma
predicates are not supported in this fallback; update references to
FL_STATIC_ASSERT_IMPL, FL_STATIC_ASSERT_2, and the removed
FL_STATIC_ASSERT_3..10 accordingly.
In `@src/platforms/arduino/io_arduino.hpp`:
- Around line 57-77: Change the read loop to keep draining Serial until
delimiter or timeout even after the output buffer is full: replace the current
while (len < outLen - 1) with an unconditional loop (e.g., while (true)) that
still checks Serial.available() and timeout; on each read (const int value =
Serial.read()), update start = millis() and if value < 0 break; convert to char
c and if c == delimiter break; only append to out and increment len while len <
outLen - 1, otherwise discard the character but continue looping to consume the
rest; leave the final out[len] = '\0' and return len. Use the existing symbols
(Serial, millis(), timeoutMs, delimiter, out, outLen, len, start) and implement
this change in the function containing the shown loop (readLineNative).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a681fc93-aa2d-48a6-8850-ad533bd6d382
📒 Files selected for processing (11)
ci/boards.pysrc/cpp_compat.hsrc/fl/gfx/colorutils.cpp.hppsrc/fl/gfx/colorutils.hsrc/fl/stl/compiler_control.hsrc/platforms/adafruit/clockless.cpp.hppsrc/platforms/arduino/io_arduino.hppsrc/platforms/avr/attiny/clockless_blocking.hsrc/platforms/avr/attiny/clockless_blocking_controller.hsrc/third_party/cq_kernel/kiss_fft.htests/fl/gfx/colorutils.cpp
💤 Files with no reviewable changes (3)
- src/third_party/cq_kernel/kiss_fft.h
- src/platforms/avr/attiny/clockless_blocking_controller.h
- src/platforms/avr/attiny/clockless_blocking.h
🚧 Files skipped from review as they are similar to previous changes (4)
- src/platforms/adafruit/clockless.cpp.hpp
- src/fl/gfx/colorutils.h
- ci/boards.py
- src/fl/gfx/colorutils.cpp.hpp
c12e15a to
0e64975
Compare
📊 Header Compilation PerformanceTotal Time: 985.20ms Top 5 Slowest Headers
Warnings
Full Report |
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/platforms/arduino/io_arduino.hpp (1)
47-86:⚠️ Potential issue | 🟠 MajorATtiny path still leaves overflow bytes (including the delimiter) in the RX buffer.
The loop exits as soon as
len == outLen - 1, so for any line longer than the caller's buffer the delimiter and trailing bytes remain inSerial. The nextreadLineNative()will then return the leftover tail as if it were a fresh line — divergent from the non-ATtinyreadStringUntilpath, which always consumes through the delimiter. Recommend continuing to drain until delimiter/timeout and only storing while space remains.Proposed fix
- while (len < outLen - 1) { + while (true) { if (!Serial.available()) { if (millis() - start >= timeoutMs) { break; } yield(); continue; } const int value = Serial.read(); if (value < 0) { break; } const char c = static_cast<char>(value); if (c == delimiter) { break; } - out[len++] = c; + if (len < outLen - 1) { + out[len++] = c; + } start = millis(); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/platforms/arduino/io_arduino.hpp` around lines 47 - 86, The ATtiny branch of readLineNative leaves extra bytes (including the delimiter) in Serial when the buffer fills; modify the read loop in readLineNative so that after len reaches outLen-1 it continues reading and discarding incoming bytes until it sees the delimiter or the timeout (timeoutMs) expires (still using Serial.available(), Serial.read(), millis(), yield()), only writing into out while len < outLen-1, and ensure the delimiter is consumed (not stored) before returning the stored length.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/platforms/arduino/io_arduino.hpp`:
- Around line 47-86: The ATtiny branch of readLineNative leaves extra bytes
(including the delimiter) in Serial when the buffer fills; modify the read loop
in readLineNative so that after len reaches outLen-1 it continues reading and
discarding incoming bytes until it sees the delimiter or the timeout (timeoutMs)
expires (still using Serial.available(), Serial.read(), millis(), yield()), only
writing into out while len < outLen-1, and ensure the delimiter is consumed (not
stored) before returning the stored length.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f7fc17e8-af5a-48cd-afbf-05979f6f26c0
📒 Files selected for processing (17)
ci/boards.pysrc/cpp_compat.hsrc/fl/gfx/colorutils.cpp.hppsrc/fl/gfx/colorutils.hsrc/fl/math/screenmap.cpp.hppsrc/fl/stl/compiler_control.hsrc/fl/stl/function.hsrc/fl/stl/pair.hsrc/fl/stl/type_traits.hsrc/platforms/adafruit/clockless.cpp.hppsrc/platforms/arduino/io_arduino.hppsrc/platforms/avr/attiny/clockless_blocking.hsrc/platforms/avr/attiny/clockless_blocking_controller.hsrc/platforms/compile_test.cpp.hppsrc/platforms/intmap.hsrc/third_party/cq_kernel/kiss_fft.htests/fl/gfx/colorutils.cpp
💤 Files with no reviewable changes (3)
- src/platforms/avr/attiny/clockless_blocking.h
- src/third_party/cq_kernel/kiss_fft.h
- src/platforms/avr/attiny/clockless_blocking_controller.h
✅ Files skipped from review due to trivial changes (6)
- src/fl/math/screenmap.cpp.hpp
- src/fl/stl/type_traits.h
- src/platforms/intmap.h
- src/platforms/compile_test.cpp.hpp
- src/fl/stl/function.h
- src/fl/stl/pair.h
🚧 Files skipped from review as they are similar to previous changes (3)
- src/cpp_compat.h
- src/fl/stl/compiler_control.h
- src/fl/gfx/colorutils.cpp.hpp
0e64975 to
3993896
Compare
📊 Header Compilation PerformanceTotal Time: 1235.44ms Top 5 Slowest Headers
Warnings
Full Report |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/fl/stl/compiler_control.h (1)
527-529: Narrowing the fallthrough attribute gating looks correct; update stale comment.Restricting
__attribute__((fallthrough))to Clang or GCC ≥ 7 correctly avoids the attribute on old AVR GCC (< 4.9 / < 7) where it isn't recognized, which matches the PR's Digispark fix. However, the comment on line 528 still reads "GCC 7+ / Clang 10+" — the condition accepts any Clang, not just 10+. Consider updating the comment for accuracy.📝 Suggested comment tweak
`#elif` defined(FL_IS_CLANG) || (defined(FL_IS_GCC) && FL_GCC_VERSION >= 700) - // GCC 7+ / Clang 10+: Use fallthrough attribute + // GCC 7+ / Clang: Use fallthrough attribute `#define` FL_FALLTHROUGH __attribute__((fallthrough))🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/stl/compiler_control.h` around lines 527 - 529, Update the stale comment above the FL_FALLTHROUGH macro: the preprocessor conditional is "#elif defined(FL_IS_CLANG) || (defined(FL_IS_GCC) && FL_GCC_VERSION >= 700)" which enables __attribute__((fallthrough)) for any Clang and GCC >= 7, so change the comment text (currently "GCC 7+ / Clang 10+: Use fallthrough attribute") to accurately reflect that it applies to Clang (all versions detected by FL_IS_CLANG) and GCC 7+, e.g. "GCC 7+ / Clang: Use fallthrough attribute" or similar, leaving the `#define` FL_FALLTHROUGH __attribute__((fallthrough)) unchanged.src/cpp_compat.h (1)
24-77: Document the 16-token limit and template-comma assumption.The dispatcher silently misbehaves in two subtle ways worth a header comment, so future callers don't get confused when an AVR build suddenly breaks:
FL_STATIC_ASSERT_SELECTonly enumerates 16 slots, so astatic_assertwhose (expression + message) contains more than 15 top-level commas falls off the list and expands to an undefined identifier rather than a readable diagnostic.- The template-comma workaround relies on the extra outer parens in
FL_STATIC_ASSERT_IMPL((FL_STATIC_ASSERT_EXPR(__VA_ARGS__)))to preserve template-arg grouping at parse time. This works when the name being instantiated is already known to the compiler as a template (typical case), but a barea < b, c > d–style predicate with no template name in scope would still be parsed as a comma expression. Worth calling out so nobody "simplifies" those outer parens away later.A short block comment above line 24 noting both would be enough; no code change required.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cpp_compat.h` around lines 24 - 77, Add a short header comment above the static_assert emulation explaining two limitations: (1) FL_STATIC_ASSERT_SELECT only supports up to 16 macro slots (so expressions+message containing more than 15 top‑level commas will fall off the selector and yield a confusing expansion), and (2) the outer parentheses in FL_STATIC_ASSERT_IMPL((FL_STATIC_ASSERT_EXPR(__VA_ARGS__))) are required to preserve template-argument grouping for template-style predicates — a bare expression like `a < b, c > d` with no template name in scope can still be parsed as a comma expression if those parens are removed. Reference the macros FL_STATIC_ASSERT_SELECT, FL_STATIC_ASSERT_EXPR, FL_STATIC_ASSERT_IMPL and the redefined static_assert in the comment so future maintainers don’t accidentally “simplify” the parens or increase argument counts without addressing these limitations.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ci/boards.py`:
- Around line 1066-1077: DIGISPARK_TINY currently lacks explicit MCU metadata so
get_mcu_target() can't detect the ATtiny85; update the Board declaration for
DIGISPARK_TINY to include board_build_mcu="attiny85" as an argument to the
Board(...) call so target-based filtering and MCU identification work correctly
(see DIGISPARK_TINY and get_mcu_target()).
In `@src/platforms/arduino/io_arduino.hpp`:
- Around line 48-87: The guard that checks outLen (outLen <= 0) must be hoisted
so both conditional branches are protected: move the outLen validation above the
`#if` defined(FL_IS_AVR_ATTINY) block (or add the same early-return check before
using outLen in the non-ATtiny branch) to immediately return 0 when outLen <= 0;
this prevents computing a negative len and passing it to memcpy in the
non-ATtiny path where Serial.readStringUntil(delimiter), line.length(),
memcpy(out, line.c_str(), len) and out[len] are used.
---
Nitpick comments:
In `@src/cpp_compat.h`:
- Around line 24-77: Add a short header comment above the static_assert
emulation explaining two limitations: (1) FL_STATIC_ASSERT_SELECT only supports
up to 16 macro slots (so expressions+message containing more than 15 top‑level
commas will fall off the selector and yield a confusing expansion), and (2) the
outer parentheses in FL_STATIC_ASSERT_IMPL((FL_STATIC_ASSERT_EXPR(__VA_ARGS__)))
are required to preserve template-argument grouping for template-style
predicates — a bare expression like `a < b, c > d` with no template name in
scope can still be parsed as a comma expression if those parens are removed.
Reference the macros FL_STATIC_ASSERT_SELECT, FL_STATIC_ASSERT_EXPR,
FL_STATIC_ASSERT_IMPL and the redefined static_assert in the comment so future
maintainers don’t accidentally “simplify” the parens or increase argument counts
without addressing these limitations.
In `@src/fl/stl/compiler_control.h`:
- Around line 527-529: Update the stale comment above the FL_FALLTHROUGH macro:
the preprocessor conditional is "#elif defined(FL_IS_CLANG) ||
(defined(FL_IS_GCC) && FL_GCC_VERSION >= 700)" which enables
__attribute__((fallthrough)) for any Clang and GCC >= 7, so change the comment
text (currently "GCC 7+ / Clang 10+: Use fallthrough attribute") to accurately
reflect that it applies to Clang (all versions detected by FL_IS_CLANG) and GCC
7+, e.g. "GCC 7+ / Clang: Use fallthrough attribute" or similar, leaving the
`#define` FL_FALLTHROUGH __attribute__((fallthrough)) unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8ff015e0-fae1-4517-8711-0ccfb49fc102
📒 Files selected for processing (17)
ci/boards.pysrc/cpp_compat.hsrc/fl/gfx/colorutils.cpp.hppsrc/fl/gfx/colorutils.hsrc/fl/math/screenmap.cpp.hppsrc/fl/stl/compiler_control.hsrc/fl/stl/function.hsrc/fl/stl/pair.hsrc/fl/stl/type_traits.hsrc/platforms/adafruit/clockless.cpp.hppsrc/platforms/arduino/io_arduino.hppsrc/platforms/avr/attiny/clockless_blocking.hsrc/platforms/avr/attiny/clockless_blocking_controller.hsrc/platforms/compile_test.cpp.hppsrc/platforms/intmap.hsrc/third_party/cq_kernel/kiss_fft.htests/fl/gfx/colorutils.cpp
💤 Files with no reviewable changes (3)
- src/platforms/avr/attiny/clockless_blocking_controller.h
- src/third_party/cq_kernel/kiss_fft.h
- src/platforms/avr/attiny/clockless_blocking.h
✅ Files skipped from review due to trivial changes (7)
- src/fl/math/screenmap.cpp.hpp
- src/platforms/compile_test.cpp.hpp
- src/fl/stl/type_traits.h
- src/fl/stl/function.h
- src/platforms/intmap.h
- src/fl/stl/pair.h
- src/fl/gfx/colorutils.cpp.hpp
🚧 Files skipped from review as they are similar to previous changes (1)
- src/platforms/adafruit/clockless.cpp.hpp
| DIGISPARK_TINY = Board( | ||
| board_name="digispark-tiny", | ||
| # PlatformIO only publishes Digistump core 1.7.2 and avr-gcc 5.4/7.3 | ||
| # packages, so the Arduino IDE 1.6.7 + avr-g++ 4.8.1 issue environment | ||
| # cannot be pinned through platform_packages here. | ||
| platform="atmelavr", | ||
| platform_packages=( | ||
| "\n\[email protected]\n\[email protected]" | ||
| ), | ||
| framework="arduino", | ||
| build_flags=["-std=gnu++11"], | ||
| ) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Inspect MCU target inference and usages for board/sketch filtering.
cat -n ci/boards.py | sed -n '361,381p;1066,1077p'
rg -n -C3 '\bget_mcu_target\s*\('Repository: FastLED/FastLED
Length of output: 3482
🏁 Script executed:
#!/bin/bash
# Get the complete get_mcu_target method
cat -n ci/boards.py | sed -n '361,400p'Repository: FastLED/FastLED
Length of output: 1809
🏁 Script executed:
#!/bin/bash
# Check what get_mcu_target returns for boards without explicit board_build_mcu
# Search for all board definitions that use board_build_mcu="attiny" to understand the pattern
rg -n 'board_build_mcu\s*=' ci/boards.py | head -20Repository: FastLED/FastLED
Length of output: 174
🏁 Script executed:
#!/bin/bash
# Check sketch_filter.py to see how get_mcu_target() result is used
cat -n ci/compiler/sketch_filter.py | sed -n '340,370p'Repository: FastLED/FastLED
Length of output: 1136
🏁 Script executed:
#!/bin/bash
# Search for sketches or configs that use target filters
rg -n 'target\s*:' --type-list | head -5
fd . examples -name "*.txt" -o -name "filter_*" | head -20Repository: FastLED/FastLED
Length of output: 679
🏁 Script executed:
#!/bin/bash
# Check for any references to digispark in the codebase
rg -n 'digispark\|digistump' -i ci/ examples/ 2>/dev/null | head -20Repository: FastLED/FastLED
Length of output: 41
🏁 Script executed:
#!/antml:bin/bash
# Check if there are other ATtiny boards for comparison
rg -n 'board_name.*tiny' ci/boards.pyRepository: FastLED/FastLED
Length of output: 438
🏁 Script executed:
#!/bin/bash
# Search for sketch configs or filter specifications
find examples -type f -name "*.txt" -o -name "*filter*" | head -20Repository: FastLED/FastLED
Length of output: 95
🏁 Script executed:
#!/bin/bash
# Look for target filter usage in examples
rg 'target\s*:' examples/ 2>/dev/null | head -20Repository: FastLED/FastLED
Length of output: 147
🏁 Script executed:
#!/bin/bash
# Check documentation or comments about Digispark and ATtiny85
rg -n 'digispark|digistump' -i ci/boards.py -A 5 -B 2Repository: FastLED/FastLED
Length of output: 920
Add board_build_mcu="attiny85" to preserve MCU target metadata for filtering.
DIGISPARK_TINY with board_name="digispark-tiny" does not match the attiny* prefix pattern checked in get_mcu_target(), so it returns None. This breaks target-based filtering and prevents proper MCU identification. The Digispark board uses an ATtiny85 MCU (as indicated by the Digistump framework reference and memory classification), and should explicitly declare it.
Suggested fix
DIGISPARK_TINY = Board(
board_name="digispark-tiny",
+ board_build_mcu="attiny85",
# PlatformIO only publishes Digistump core 1.7.2 and avr-gcc 5.4/7.3🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@ci/boards.py` around lines 1066 - 1077, DIGISPARK_TINY currently lacks
explicit MCU metadata so get_mcu_target() can't detect the ATtiny85; update the
Board declaration for DIGISPARK_TINY to include board_build_mcu="attiny85" as an
argument to the Board(...) call so target-based filtering and MCU identification
work correctly (see DIGISPARK_TINY and get_mcu_target()).
| #if defined(FL_IS_AVR_ATTINY) | ||
| if (outLen <= 0) { | ||
| return 0; | ||
| } | ||
| // TinyDebugSerial lacks readStringUntil(), so keep Stream's blocking | ||
| // line-read behavior without allocating Arduino String. | ||
| const unsigned long timeoutMs = 1000UL; | ||
| unsigned long start = millis(); | ||
| int len = 0; | ||
| while (true) { | ||
| if (!Serial.available()) { | ||
| if (millis() - start >= timeoutMs) { | ||
| break; | ||
| } | ||
| yield(); | ||
| continue; | ||
| } | ||
| const int value = Serial.read(); | ||
| if (value < 0) { | ||
| break; | ||
| } | ||
| const char c = static_cast<char>(value); | ||
| if (c == delimiter) { | ||
| break; | ||
| } | ||
| if (len < outLen - 1) { | ||
| out[len++] = c; | ||
| } | ||
| start = millis(); | ||
| } | ||
| out[len] = '\0'; | ||
| return len; | ||
| #else | ||
| String line = Serial.readStringUntil(delimiter); | ||
| int len = line.length(); | ||
| if (len > outLen - 1) len = outLen - 1; | ||
| memcpy(out, line.c_str(), len); | ||
| out[len] = '\0'; | ||
| return len; | ||
| #endif |
There was a problem hiding this comment.
Hoist the outLen guard so both branches are protected.
Line 49 only validates outLen for FL_IS_AVR_ATTINY. On non-ATtiny builds, outLen <= 0 can still make Line 83 set len negative, then Line 84 passes it to memcpy as a huge size_t and Line 85 writes out of bounds.
Proposed fix
int readLineNative(char delimiter, char* out, int outLen) FL_NOEXCEPT {
-#if defined(FL_IS_AVR_ATTINY)
if (outLen <= 0) {
return 0;
}
+#if defined(FL_IS_AVR_ATTINY)
// TinyDebugSerial lacks readStringUntil(), so keep Stream's blocking
// line-read behavior without allocating Arduino String.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/platforms/arduino/io_arduino.hpp` around lines 48 - 87, The guard that
checks outLen (outLen <= 0) must be hoisted so both conditional branches are
protected: move the outLen validation above the `#if` defined(FL_IS_AVR_ATTINY)
block (or add the same early-return check before using outLen in the non-ATtiny
branch) to immediately return 0 when outLen <= 0; this prevents computing a
negative len and passing it to memcpy in the non-ATtiny path where
Serial.readStringUntil(delimiter), line.length(), memcpy(out, line.c_str(), len)
and out[len] are used.
|
The failing job is hitting the zccache strict-path Meson normalizer, not the Digispark source patch: Root cause: the #2385 normalizer handled quoted Meson private include flags but Linux emits this one unquoted. I opened the master CI fix here: #2389 Once #2389 lands on |
3993896 to
f4d0cd8
Compare
📊 Header Compilation PerformanceTotal Time: 1178.51ms Top 5 Slowest Headers
Warnings
Full Report |
Summary
static_assertfallback and KISS FFT fixed-point includes)static_assertdispatcher with one variadic macro backed by a template, with template-comma expressions parenthesized at source call sitesdigispark-tinyto the board registry for targeted/local compile coverage without adding a new GitHub Actions workflow[email protected],[email protected])src/fl/gfx/colorutils.hFixes #2379.
Follow-up: #2387 tracks whether fbuild should support Digistump/Digispark's
dtinyAVR core out of the box. Current result: fbuild resolves the environment in dry-run, but actual compile fails withno AVR framework registered for core 'dtiny', so this PR keepsdigispark-tinyon the PlatformIO path.Note: PlatformIO does not publish the exact Arduino IDE issue environment (
Digistump AVR Boards 1.6.7with avr-g++ 4.8.1), so this PR pins the closest available PlatformIO Digistump packages and leaves exact legacy fbuild/package support to #2387.Validation
static_assertfallback branch through avr-g++ with template-comma expressions and a pre-existingstatic_assertmacrouv run ci/ci-compile.py digispark-tiny Blinkuv run ci/ci-compile.py attiny85 Blink& 'C:\Program Files\Git\bin\bash.exe' lintSummary by CodeRabbit
New Features
Refactor