Repository navigation
Description
Summary
The apollo3_red (build_apollo3_red.yml) and apollo3_thing_explorable (build_apollo3_thing_explorable.yml) workflows are both failing on master. Confirmed on CI at https://github.com/FastLED/FastLED/actions/runs/27004403630 (apollo3_red) and https://github.com/FastLED/FastLED/actions/runs/27004348246 (apollo3_thing_explorable).
This is the next group from the README badge sweep after the AVR family (#2779/#2780) and STM32 GIGA (#2784/#2785). Both Apollo3 boards share a single root cause.
Failure
src/platforms/apollo3/watchdog_apollo3.impl.hpp:96:17: error:
'struct RSTGEN_Type' has no member named 'CLRSTAT'
The Apollo3 watchdog hardware impl tries to write RSTGEN->CLRSTAT = 1u; to clear sticky reset-status bits, but RSTGEN_Type in the SparkFun Arduino_Apollo3 v2.2.1 CMSIS header has no such member — the struct goes CFG, SWPOI, SWPOR, TPIURST, INTEN/INTSTAT/INTCLR/INTSET (the latter group is for the BODH brown-out interrupt only), STAT. No clear register exists for STAT.
Root cause — and a second bug
Two issues in src/platforms/apollo3/watchdog_apollo3.impl.hpp:
Compile error — the RSTGEN->CLRSTAT write at line 96. The Apollo3 STAT register bits are SBL-latched (set by the Secondary Boot Loader at boot time) and cannot be cleared by software. Quoting AmbiqMicro's CMSIS header: every STAT_b bit comment ends with (SBL). The intended one-shot caching is already provided by cause_cached in Apollo3WatchdogState — the register write was both impossible and unnecessary.
Runtime bug (latent) — the bit-position table in the comment and the if/else chain (lines 68–89) is wrong against the actual RSTGEN_Type layout:
| Bit | Per FastLED comment | Actual hardware (CMSIS STAT_b) |
|---|---|---|
| 0 | EXRSTAT external pin |
EXRSTAT ✓ |
| 1 | PORSTAT power-on |
PORSTAT ✓ |
| 2 | BORSTAT brown-out |
BORSTAT ✓ |
| 3 | SWRSTAT software |
SWRSTAT ✓ |
| 4 | POIRSTAT POI |
POIRSTAT ✓ |
| 5 | DBGRSTAT debugger |
DBGRSTAT ✓ |
| 6 | POISTAT power-on initiated |
WDRSTAT watchdog |
| 7 | WDRSTAT watchdog |
BOUSTAT unregulated brown-out |
So if (stat & (1u << 7)) cause = WATCHDOG actually reads the unregulated-brownout bit, and else if (stat & (1u << 6)) cause = POWER_ON actually reads the watchdog bit. If this had ever compiled, lastResetWasWatchdog() would never have returned true after a real watchdog reset, and would have falsely reported watchdog after an unregulated-supply brown-out. The compile failure inadvertently protected callers from shipping broken behavior.
Fix
In src/platforms/apollo3/watchdog_apollo3.impl.hpp:
- Delete the
RSTGEN->CLRSTAT = 1u;line — STAT bits are SBL-set / sticky; the one-shot caching viacause_cachedalready handles re-reads. - Correct the bit-position comment and the
if/elsechain to match the actualRSTGEN_Type::STAT_blayout (bit 6 = watchdog, bit 7 = unregulated brown-out, bit 8 = core-regulator brown-out, bit 9 = memory-regulator brown-out, bit 10 = BLE/burst-regulator brown-out). - Map the additional brown-out variants (
BOUSTAT/BOCSTAT/BOFSTAT/BOBSTAT) toResetCause::BROWNOUTas well, so all flavors of brown-out report consistently.
Acceptance criteria
-
bash compile apollo3_redpasses on master -
bash compile apollo3_thing_explorablepasses on master -
build_apollo3_red.ymlandbuild_apollo3_thing_explorable.ymlgo green on CI -
lastResetWasWatchdog()actually reads the watchdog bit (bit 6) on Apollo3 — verifiable by inspection of the diff
Out of scope
- Other red badges still in the sweep:
rp2040,check_esp32_size,check_teensy41_size,uno AVR8JS Test. Each will be filed separately.
Next badge group after #2784 (STM32 GIGA core detection). Filed via /loop README badge sweep.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(watchdog/apollo3): drop non-existent RSTGEN::CLRSTAT + correct ST…