Repository navigation
feat(stm32): add Arduino UNO Q support - #2678
Conversation
📝 WalkthroughWalkthroughFastLED now supports Arduino UNO Q boards (STM32U585 MCU running ArduinoCore-zephyr). The PR routes STM32U5 targets through the STM32 platform code, adds a new Zephyr Arduino core detection variant, introduces Zephyr-specific sysdefs and interrupt handlers, defines STM32U5 GPIO pin support and the UNO Q board pinout, and includes CI/PlatformIO configuration. ChangesArduino UNO Q / STM32U585 / Zephyr Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 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 docstrings
🧪 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: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/platforms/arm/stm32/fastpin_arm_stm32.h (1)
17-21:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDon't enable the new board dispatcher for unsupported generic U5 macros yet.
fastpin_dispatcher.honly has a U5 board case forARDUINO_UNO_Q/CONFIG_BOARD_ARDUINO_UNO_Q. Opting plainSTM32U5*andCONFIG_SOC_STM32U585XXintoUSE_NEW_STM32_PIN_DEFINITIONSmeans non-UNO-Q U5 builds now fall straight into the dispatcher's unknown-board#error.Suggested fix
-#if defined(ARDUINO_BLUEPILL_F103C8) || defined(ARDUINO_MAPLE_MINI) || defined(ARDUINO_GENERIC_STM32F103T) || defined(STM32F103TBU6) || defined(STM32F103TB) || defined(__STM32F1__) || defined(STM32F1) || defined(STM32F103C8) || defined(ARDUINO_GENERIC_STM32F103C8) || defined(ARDUINO_GENERIC_F103C8TX) || defined(STM32F4) || defined(STM32F4xx) || defined(STM32U5) || defined(STM32U5xx) || defined(STM32U585xx) || defined(STM32U585XX) || defined(ARDUINO_UNO_Q) || defined(CONFIG_BOARD_ARDUINO_UNO_Q) || defined(CONFIG_SOC_STM32U585XX) +#if defined(ARDUINO_BLUEPILL_F103C8) || defined(ARDUINO_MAPLE_MINI) || defined(ARDUINO_GENERIC_STM32F103T) || defined(STM32F103TBU6) || defined(STM32F103TB) || defined(__STM32F1__) || defined(STM32F1) || defined(STM32F103C8) || defined(ARDUINO_GENERIC_STM32F103C8) || defined(ARDUINO_GENERIC_F103C8TX) || defined(STM32F4) || defined(STM32F4xx) || defined(ARDUINO_UNO_Q) || defined(CONFIG_BOARD_ARDUINO_UNO_Q)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/platforms/arm/stm32/fastpin_arm_stm32.h` around lines 17 - 21, The preprocessor condition enabling USE_NEW_STM32_PIN_DEFINITIONS is too broad and includes generic STM32U5 macros which are not supported by fastpin_dispatcher.h; restrict the `#if` that defines USE_NEW_STM32_PIN_DEFINITIONS to exclude STM32U5/STM32U5xx/STM32U585xx/STM32U585XX and CONFIG_SOC_STM32U585XX so only the supported UNO-Q identifiers (ARDUINO_UNO_Q / CONFIG_BOARD_ARDUINO_UNO_Q) and the previously-working F1/F4/F103 variants trigger USE_NEW_STM32_PIN_DEFINITIONS, or alternatively add explicit handling for U5 boards in fastpin_dispatcher.h before adding those U5 macros—update the condition around USE_NEW_STM32_PIN_DEFINITIONS accordingly.
🧹 Nitpick comments (1)
.github/workflows/build_arduino_uno_q.yml (1)
27-27: ⚡ Quick winExpand UNO Q bring-up example coverage beyond
Blink.
.github/workflows/build_arduino_uno_q.ymlonly compilesarduino_uno_q --examples Blink, while the STM32/Nucleo/Giga workflows compile the full set viaargs: <board> allinbuild_template.yml. Add at least one more representative example for UNO Q (e.g.,Apa102, which is already exercised elsewhere likebuild_attiny4313.yml) to improve chipset/feature coverage.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/build_arduino_uno_q.yml at line 27, The workflow currently only builds the UNO Q example via the args value "arduino_uno_q --examples Blink"; update the args for the UNO Q job in .github/workflows/build_arduino_uno_q.yml to include an additional representative example (e.g., add "Apa102" or switch to "all") so the job compiles more than just Blink and increases coverage of chipset/features; locate the line containing args: arduino_uno_q --examples Blink and replace or extend the examples list accordingly (for example "arduino_uno_q --examples Blink,Apa102" or "arduino_uno_q all").
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/platforms.h`:
- Line 31: The preprocessor selector in src/platforms.h omits the SoC macro
CONFIG_SOC_STM32U585XX used by is_stm32.h, so add CONFIG_SOC_STM32U585XX to the
same `#elif` list that currently contains STM32F10X_MD, __STM32F1__, STM32F1,
STM32F1xx, STM32F2XX, STM32F4, STM32U5, STM32U5xx, STM32U585xx, STM32U585XX,
ARDUINO_UNO_Q, CONFIG_BOARD_ARDUINO_UNO_Q so the STM32/U5 path is selected when
only the SoC macro is defined; also apply the identical update to
src/led_sysdefs.h so both dispatch gates match is_stm32.h.
In `@src/platforms/arm/fastpin_arm.h`:
- Around line 31-33: The STM32 dispatcher branch is missing the
CONFIG_SOC_STM32U585XX macro, so add CONFIG_SOC_STM32U585XX to the `#elif`
condition that currently checks STM32U585xx/STM32U5/etc. Ensure the condition
includes CONFIG_SOC_STM32U585XX alongside existing
STM32U585xx/STM32U585XX/STM32U5 macros so that the include
"platforms/arm/stm32/fastpin_arm_stm32.h" is selected when
CONFIG_SOC_STM32U585XX is defined.
In `@src/platforms/arm/stm32/core_detection.h`:
- Around line 42-46: The change introduced a distinct MBED core flag
(_FL_STM32_HAS_MBED / FL_IS_STM32_MBED) even though the STM32 dispatch headers
(led_sysdefs_arm_stm32.h, interrupts_stm32.h) do not handle an MBED case; revert
or gate that new classification so MBED builds continue to be treated as one of
the existing cores (PARTICLE, LIBMAPLE, STMDUINO, or ZEPHYR) until the dispatch
headers are extended. Concretely, remove or disable the new MBED-specific define
in core_detection.h (keep _FL_STM32_HAS_MBED set to 0 and do not expose
FL_IS_STM32_MBED) so compilation will follow the established dispatch paths, and
add a TODO comment referencing led_sysdefs_arm_stm32.h and interrupts_stm32.h to
add a proper MBED branch when those headers are updated.
In `@src/platforms/arm/stm32/led_sysdefs/led_sysdefs_stm32_zephyr.h`:
- Around line 15-20: The current fallback that defines F_CPU to 160000000UL
should be removed and the build should fail if
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC is not provided; update the conditional
around F_CPU so that when CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC is defined you
`#define` F_CPU CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC (keeping the existing branch),
and otherwise emit a preprocessor error (e.g., using `#error`) with a clear
message that CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC must be defined instead of
silently defaulting to 160000000UL; target the block that defines F_CPU and
references CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC to make this change.
---
Outside diff comments:
In `@src/platforms/arm/stm32/fastpin_arm_stm32.h`:
- Around line 17-21: The preprocessor condition enabling
USE_NEW_STM32_PIN_DEFINITIONS is too broad and includes generic STM32U5 macros
which are not supported by fastpin_dispatcher.h; restrict the `#if` that defines
USE_NEW_STM32_PIN_DEFINITIONS to exclude
STM32U5/STM32U5xx/STM32U585xx/STM32U585XX and CONFIG_SOC_STM32U585XX so only the
supported UNO-Q identifiers (ARDUINO_UNO_Q / CONFIG_BOARD_ARDUINO_UNO_Q) and the
previously-working F1/F4/F103 variants trigger USE_NEW_STM32_PIN_DEFINITIONS, or
alternatively add explicit handling for U5 boards in fastpin_dispatcher.h before
adding those U5 macros—update the condition around USE_NEW_STM32_PIN_DEFINITIONS
accordingly.
---
Nitpick comments:
In @.github/workflows/build_arduino_uno_q.yml:
- Line 27: The workflow currently only builds the UNO Q example via the args
value "arduino_uno_q --examples Blink"; update the args for the UNO Q job in
.github/workflows/build_arduino_uno_q.yml to include an additional
representative example (e.g., add "Apa102" or switch to "all") so the job
compiles more than just Blink and increases coverage of chipset/features; locate
the line containing args: arduino_uno_q --examples Blink and replace or extend
the examples list accordingly (for example "arduino_uno_q --examples
Blink,Apa102" or "arduino_uno_q all").
🪄 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: f801f097-8674-44dd-9fc9-b82dc1fa9a16
📒 Files selected for processing (23)
.github/workflows/build_arduino_uno_q.yml.gitignoreREADME.mdci/boards.pyci/boards/arduino_uno_q.jsonci/lint_cpp/native_platform_defines_checker.pysrc/fl/math/qfx.hsrc/led_sysdefs.hsrc/platforms.hsrc/platforms/arm/fastpin_arm.hsrc/platforms/arm/int.hsrc/platforms/arm/stm32/core_detection.hsrc/platforms/arm/stm32/fastpin_arm_stm32.hsrc/platforms/arm/stm32/interrupts/interrupts_stm32_zephyr.hsrc/platforms/arm/stm32/interrupts_stm32.hsrc/platforms/arm/stm32/is_stm32.hsrc/platforms/arm/stm32/led_sysdefs/led_sysdefs_stm32_zephyr.hsrc/platforms/arm/stm32/led_sysdefs_arm_stm32.hsrc/platforms/arm/stm32/pins/boards/u5/uno_q.hsrc/platforms/arm/stm32/pins/families/stm32u5.hsrc/platforms/arm/stm32/pins/fastpin_dispatcher.hsrc/platforms/cpu_frequency.hsrc/platforms/generic_pin.h
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/platforms/arm/stm32/led_sysdefs/led_sysdefs_stm32_zephyr.h (1)
2-2: ⚡ Quick winReplace
#pragma oncewith FastLED compiler control macro.Same guideline violation as the other two headers in this review: use FastLED compiler control macros instead of raw
#pragma once. As per coding guidelines: "Use FastLED compiler control macros from fl/stl/compiler_control.h instead of raw#pragmadirectives".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/platforms/arm/stm32/led_sysdefs/led_sysdefs_stm32_zephyr.h` at line 2, Replace the raw "`#pragma` once" in led_sysdefs_stm32_zephyr.h with the FastLED compiler control macros: include "fl/stl/compiler_control.h" and wrap the header with the begin/end compiler-control macros provided there (use the library's standard header-guard/pragma macros instead of raw `#pragma` once), so the file uses the FastLED compiler control mechanism consistently with other headers.src/platforms/arm/stm32/led_sysdefs/led_sysdefs_stm32_mbed.h (1)
2-2: ⚡ Quick winReplace
#pragma oncewith FastLED compiler control macro.Same guideline violation as in
interrupts_stm32_mbed.h: use the FastLED compiler control macro instead of raw#pragma once. As per coding guidelines: "Use FastLED compiler control macros from fl/stl/compiler_control.h instead of raw#pragmadirectives".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/platforms/arm/stm32/led_sysdefs/led_sysdefs_stm32_mbed.h` at line 2, The header uses a raw "`#pragma` once"; replace it with the FastLED compiler control macro used across the project: add `#include` <fl/stl/compiler_control.h> at the top of led_sysdefs_stm32_mbed.h and replace "`#pragma` once" with the FastLED pragma macro (e.g. FASTLED_PRAGMA_ONCE) consistent with interrupts_stm32_mbed.h so the file uses the project's compiler_control.h macros instead of a raw pragma.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/platforms/arm/stm32/led_sysdefs/led_sysdefs_stm32_mbed.h`:
- Line 2: The header uses a raw "`#pragma` once"; replace it with the FastLED
compiler control macro used across the project: add `#include`
<fl/stl/compiler_control.h> at the top of led_sysdefs_stm32_mbed.h and replace
"`#pragma` once" with the FastLED pragma macro (e.g. FASTLED_PRAGMA_ONCE)
consistent with interrupts_stm32_mbed.h so the file uses the project's
compiler_control.h macros instead of a raw pragma.
In `@src/platforms/arm/stm32/led_sysdefs/led_sysdefs_stm32_zephyr.h`:
- Line 2: Replace the raw "`#pragma` once" in led_sysdefs_stm32_zephyr.h with the
FastLED compiler control macros: include "fl/stl/compiler_control.h" and wrap
the header with the begin/end compiler-control macros provided there (use the
library's standard header-guard/pragma macros instead of raw `#pragma` once), so
the file uses the FastLED compiler control mechanism consistently with other
headers.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f5bb8690-fcf0-48ac-bc67-a9217fbc6540
📒 Files selected for processing (10)
.github/workflows/build_arduino_uno_q.ymlsrc/led_sysdefs.hsrc/platforms.hsrc/platforms/arm/fastpin_arm.hsrc/platforms/arm/stm32/fastpin_arm_stm32.hsrc/platforms/arm/stm32/interrupts/interrupts_stm32_mbed.hsrc/platforms/arm/stm32/interrupts_stm32.hsrc/platforms/arm/stm32/led_sysdefs/led_sysdefs_stm32_mbed.hsrc/platforms/arm/stm32/led_sysdefs/led_sysdefs_stm32_zephyr.hsrc/platforms/arm/stm32/led_sysdefs_arm_stm32.h
🚧 Files skipped from review as they are similar to previous changes (7)
- src/platforms/arm/fastpin_arm.h
- src/platforms/arm/stm32/fastpin_arm_stm32.h
- src/platforms/arm/stm32/interrupts_stm32.h
- .github/workflows/build_arduino_uno_q.yml
- src/platforms/arm/stm32/led_sysdefs_arm_stm32.h
- src/led_sysdefs.h
- src/platforms.h
Summary
Fixes #2674.
Refs FastLED/fbuild#363.
Refs FastLED/fbuild#364.
Refs FastLED/fbuild#365.
Verification
git diff --checkuv run python -m pytest ci\lint_cpp\test_native_platform_defines_checker.py ci\lint_cpp\test_is_header_include_checker.py -quv run python ci\ci-compile.py arduino_uno_q --examples Blink,Apa102 --no-interactive --no-parallel --local --backend platformio --log-failures .build\uno_q_platformio_failures --max-failures 1uv run python ci\ci-compile.py stm32f103c8,stm32f411ce,stm32h747xi --examples Blink --no-interactive --no-parallel --local --backend platformio --log-failures .build\stm32_regression_failures --max-failures 1uv run python ci\ci-compile.py stm32h747xi --examples Blink --no-interactive --no-parallel --local --backend platformio --log-failures .build\stm32_regression_failures --max-failures 1arduino-cli compile --fqbn arduino:zephyr:unoq --additional-urls https://downloads.arduino.cc/packages/package_zephyr_index.json --library . examples\Blinkarduino-cli compile --fqbn arduino:zephyr:unoq --additional-urls https://downloads.arduino.cc/packages/package_zephyr_index.json --library . examples\Apa102Summary by CodeRabbit
New Features
Chores
Documentation