Skip to content

test(autoresearch): arm the boot-loop bootloader escape (#3713) - #4172

Merged
zackees merged 1 commit into
masterfrom
test/3899-rp2350w-bringup
Sep 7, 2026
Merged

zackees merged 1 commit into
masterfrom
test/3899-rp2350w-bringup

Conversation

@zackees

@zackees zackees commented Sep 7, 2026 •

Copy link
Copy Markdown
Member

Enables the boot-loop escape from #4167 in AutoResearch, and records the RP2350W bring-up evidence #3899 asked for.

Change

One block in setup(), immediately after Watchdog::begin():

fl::Watchdog::instance().setBootloaderEscapeThreshold(AUTORESEARCH_BOOTLOADER_ESCAPE_RESETS);
fl::Watchdog::instance().escapeToBootloaderIfLooping();

The WDT armed just above turns a hang into a reboot. But a hang that recurs every boot just reboots forever — the board is only ever briefly enumerated, and unattended that is indistinguishable from a brick. After three consecutive watchdog resets the board now drops into the bootloader, where it re-enumerates as a flashable target and the host can push working firmware without anyone holding BOOTSEL.

Placement matters: before serial, RPC bind, or any peripheral that may be absent on this board variant. Three tolerates a one-off glitch and the deliberate --watchdog-soak recovery test while still escaping fast enough to matter.

Why this was worth doing first

It was the parachute that made the rp2350w bring-up safe to attempt. The bench board's variant was genuinely unknown — the ROM reports Board-ID: RP2350 for both, and the Pico 2 product string on the running firmware came from the rpipico2 definition that had been flashed, not the silicon. Flashing W firmware onto a plain Pico 2 risks a CYW43 hang with no CDC and no software recovery. With the escape armed, a wrong guess self-recovers into BOOTSEL instead.

Hardware results

Validated the escape on the known-good non-W build first, before relying on it:

  • rp2350: RPC smoke PASS, lastResetCause: SOFTWARE, lastResetWasWatchdog: False — no misfire on a healthy boot.
  • rp2350w: RPC smoke PASS after a cross-variant reflash.

The board is a Pico 2 W, which #3899 listed as unestablished:

2e8a:f00f  'Pico 2W'                                    # rpipico2w application CDC
status    -> platform: "Raspberry Pi Pico 2 W (RP2350)"
wifiStatus-> {"status": "IDLE", "success": true}        # was UNSUPPORTED on the non-W build

2E8A:F00F matches the identity recorded in #3899/#3832 and published in the FastLED/boards registry.

Other results from the same session, for the record:

Note on cross-variant reflash

The first rp2350w deploy failed clean, without flashing:

deploy error: RP-series picotool deployment requires the selected runtime USB serial
so fbuild can bind the BOOTSEL operation to one board

Correct behavior — the running non-W identity did not match the rp2350w environment, so fbuild would not guess which board to touch. Passing --upload-port explicitly resolved it, which is what #3899 prescribes for this case.

Verification

  • bash lint — all checks passed
  • Built and run on real hardware for both RP2350 variants (above)

🤖 Generated with Claude Code

https://claude.ai/code/session_01KkufoNxfnNRU9psT3R9F51

Summary by CodeRabbit

  • New Features
    • Added a configurable boot-loop escape mechanism to the AutoResearch example.
    • Boards that repeatedly restart due to watchdog resets now enter the bootloader, allowing recovery and reflashing instead of restarting indefinitely.

Enables the escape added in #4167 so a board whose firmware wedges every
boot stops needing a human.

The WDT armed just above turns a hang into a reboot, but a hang that
recurs every boot just reboots forever: the board is only ever briefly
enumerated, and unattended that is indistinguishable from a brick. After
three consecutive watchdog resets AutoResearch now drops into the
bootloader, where the board re-enumerates as a flashable target and the
host can push working firmware without anyone holding BOOTSEL.

Placed immediately after `Watchdog::begin()` so it runs before anything
that could hang -- serial, RPC bind, or a peripheral that is absent on
this board variant. Three tolerates a one-off glitch, and the deliberate
`--watchdog-soak` recovery test, while still escaping quickly enough to
matter on an unattended bench.

Verified on hardware, both RP2350 variants:

- rp2350 (non-W): RPC smoke PASS, lastResetCause SOFTWARE,
  lastResetWasWatchdog False -- the escape does not misfire on a healthy
  boot.
- rp2350w: RPC smoke PASS after a cross-variant reflash.

This was the parachute that made the rp2350w bring-up safe to attempt: a
wrong variant guess would have self-recovered into BOOTSEL rather than
stranding the board. The board turned out to be a Pico 2 W, confirmed by
USB identity 2E8A:F00F and `status.platform` "Raspberry Pi Pico 2 W
(RP2350)" -- the live evidence #3899 asked for.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KkufoNxfnNRU9psT3R9F51
@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: be2518db-9426-428a-ad3a-3edc346a03b1

📥 Commits

Reviewing files that changed from the base of the PR and between 8f6c050 and 8cec208.

📒 Files selected for processing (1)
  • examples/AutoResearch/AutoResearch.ino

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The AutoResearch sketch now detects repeated watchdog resets during boot. After three consecutive resets by default, it enters the bootloader instead of restarting indefinitely. The reset threshold can be changed with a compile-time macro.

Changes

AutoResearch boot-loop escape

Layer / File(s) Summary
Configure and trigger bootloader escape
examples/AutoResearch/AutoResearch.ino
Adds the AUTORESEARCH_BOOTLOADER_ESCAPE_RESETS threshold, defaulting to 3. Configures the watchdog with this threshold and checks for a repeated boot loop during setup().

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 8cec2

AutoResearch now enters the bootloader after repeated watchdog-reset boot failures, enabling recovery rather than indefinite rebooting. The change is ready to merge with no active current-head risks identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the AutoResearch boot-loop bootloader escape change. The test prefix is consistent with the validation focus in the objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/3899-rp2350w-bringup

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant