Repository navigation
fix(stm32): priority-gate core detection so Mbed-on-STM32H7 (GIGA R1) builds (Closes #2784) - #2785
Conversation
… builds `platforms/arm/stm32/core_detection.h` validates `_FL_STM32_CORE_COUNT <= 1` across five per-core flags (STM32duino, Zephyr, Mbed, LibMaple, Particle). Each flag was set unconditionally from its identifier macros, but Arduino frameworks define each other's compat identifiers — Mbed-on-STM32H7 (the Arduino GIGA R1 toolchain) defines BOTH `ARDUINO_ARCH_MBED` AND `ARDUINO_ARCH_STM32`, and its CMSIS layer pulls in `STM32_MCU_SERIES` for HAL register configuration. The count went to ≥2 and the hard `#error` fired, breaking `bash compile stm32h747xi` and the `build_giga_r1.yml` GitHub Actions workflow. The elif chain in the same file already resolved the ambiguity correctly by priority (Zephyr > Mbed > STM32duino > LibMaple > Particle) — only the validation count was wrong. Make each per-core flag mirror the elif priority: each lower-priority core counts only when no higher-priority core is detected. This preserves the validation's ability to catch genuine misconfigurations (two unrelated cores' libraries linked into one image) while letting legitimate Mbed, Zephyr, etc. builds compile cleanly. Same change drops the redundant `F_CPU` redefinition warning from `platforms/arm/giga/led_sysdef_arm_giga.h:39` by guarding with `#ifndef`. Verified locally with `bash compile`: PASS stm32h747xi (Arduino GIGA R1 / Mbed-on-STM32H7 — previously broken) PASS stm32f103c8 (bluepill / STM32duino — regression guard) PASS stm32f103cb (maple mini / STM32duino — regression guard) PASS stm32f103tb (tinystm / STM32duino — regression guard) PASS stm32f411ce (blackpill / STM32duino — regression guard) PASS nucleo_f429zi (Nucleo F429 / STM32duino — regression guard) PASS nucleo_f439zi (Nucleo F439 / STM32duino — regression guard) `bash lint` clean. Closes #2784 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR updates ARM platform macro definitions to enforce cleaner build-environment integration. The Giga header now uses ChangesPlatform Macro Guarding and STM32 Core Priority
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Summary
Fixes the `build_giga_r1.yml` workflow (Arduino GIGA R1 / `stm32h747xi`) by making STM32 core detection priority-aware. Closes #2784.
What's broken
`platforms/arm/stm32/core_detection.h` defines five per-core flags (STM32duino, Zephyr, Mbed, LibMaple, Particle) and asserts `_FL_STM32_CORE_COUNT <= 1`. Each flag was set unconditionally from its identifier macros — but Arduino frameworks define each other's compat identifiers:
Count went to ≥2 → hard `#error` → CI red.
The elif chain in the same file already resolves the ambiguity correctly (Zephyr > Mbed > STM32duino > LibMaple > Particle) — only the validation count was wrong.
What this PR changes
Each per-core flag now mirrors the elif priority: each lower-priority core counts only when no higher-priority core is also detected. Same change drops the redundant `F_CPU` redefinition warning from `led_sysdef_arm_giga.h` by guarding with `#ifndef`.
The validation's intent — catch genuine misconfigurations (two unrelated cores' libraries linked into one image with neither winning by priority) — is preserved. Legitimate single-core builds where the framework supplies compat identifiers now compile cleanly.
Test plan
Verified locally with `bash compile`:
```
PASS stm32h747xi (Arduino GIGA R1 / Mbed-on-STM32H7 — previously broken)
PASS stm32f103c8 (bluepill / STM32duino — regression guard)
PASS stm32f103cb (maple mini / STM32duino — regression guard)
PASS stm32f103tb (tinystm / STM32duino — regression guard)
PASS stm32f411ce (blackpill / STM32duino — regression guard)
PASS nucleo_f429zi (Nucleo F429 / STM32duino — regression guard)
PASS nucleo_f439zi (Nucleo F439 / STM32duino — regression guard)
```
`bash lint` clean.
Scope
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes