Repository navigation
test(autoresearch): arm the boot-loop bootloader escape (#3713) - #4172
Conversation
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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe 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. ChangesAutoResearch boot-loop escape
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to 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)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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 |
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 afterWatchdog::begin():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-soakrecovery test while still escaping fast enough to matter.Why this was worth doing first
It was the parachute that made the
rp2350wbring-up safe to attempt. The bench board's variant was genuinely unknown — the ROM reportsBoard-ID: RP2350for both, and thePico 2product string on the running firmware came from therpipico2definition 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:F00Fmatches the identity recorded in #3899/#3832 and published in the FastLED/boards registry.Other results from the same session, for the record:
findConnectedPinsas TX GPIO0 → RX GPIO1, which test(rp2350): complete RP2350(W) loopback driver and subsystem HIL #3899 required be proven rather than assumed.--net-peerdeploys both boards and completes 6/10 cycles before an intermittent serial-RPC reply drop (No response with ID 115 within 2.54s). Not a crash and not a network fault; both boards stayed enumerated. That is the same classci/autoresearch/rpc_bench.pydocuments and fix(autoresearch): stabilize RP2350W peer cycles and OTA staging #4097 targeted — reported separately rather than folded in here.Note on cross-variant reflash
The first
rp2350wdeploy failed clean, without flashing:Correct behavior — the running non-W identity did not match the
rp2350wenvironment, so fbuild would not guess which board to touch. Passing--upload-portexplicitly resolved it, which is what #3899 prescribes for this case.Verification
bash lint— all checks passed🤖 Generated with Claude Code
https://claude.ai/code/session_01KkufoNxfnNRU9psT3R9F51
Summary by CodeRabbit