Skip to content

broken builds: apollo3_red + apollo3_thing_explorable — RSTGEN::CLRSTAT doesn't exist (+ wrong reset-cause bit positions) #2787

Closed

Description

@zackees

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:

  1. Delete the RSTGEN->CLRSTAT = 1u; line — STAT bits are SBL-set / sticky; the one-shot caching via cause_cached already handles re-reads.
  2. Correct the bit-position comment and the if/else chain to match the actual RSTGEN_Type::STAT_b layout (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).
  3. Map the additional brown-out variants (BOUSTAT/BOCSTAT/BOFSTAT/BOBSTAT) to ResetCause::BROWNOUT as well, so all flavors of brown-out report consistently.

Acceptance criteria

  • bash compile apollo3_red passes on master
  • bash compile apollo3_thing_explorable passes on master
  • build_apollo3_red.yml and build_apollo3_thing_explorable.yml go 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.

Activity

  1. moved this from Triage to Done in FastLED Trackeron Jun 5, 2026
  2. added a commit that references this issue on Jun 5, 2026
    280184c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions