soc_rp2040::watchdog
RP2040 watchdog control and retained reset reason.
The load conversion follows the Pico SDK and NuttX: RP2040-E1 makes the counter decrement twice per watchdog tick, so one millisecond is 2,000 load counts when the tick generator runs at 1 MHz.
Functions
Section titled “Functions”unsafe fn arm(timeout_ms: u32, pause_on_debug: bool)Start the watchdog. The debugger may optionally pause its counter.
Safety
Section titled “Safety”Changes reset routing and commits the chip to resetting at the timeout.
arm_panic_recovery
Section titled “arm_panic_recovery”unsafe fn arm_panic_recovery(timeout_ms: u32)Start a watchdog reset that reboots the application once before BOOTSEL.
Safety
Section titled “Safety”Commits the chip to resetting at the timeout and changes retained scratch state.
clear_flint_watchdog_marker
Section titled “clear_flint_watchdog_marker”unsafe fn clear_flint_watchdog_marker()Clear FlintOS’s retained marker after consuming the reset report.
Safety
Section titled “Safety”Writes a retained scratch register used by reset handling.
disarm
Section titled “disarm”unsafe fn disarm()Stop the watchdog.
Safety
Section titled “Safety”Disables automatic recovery from a stopped kernel.
unsafe fn feed(timeout_ms: u32)Reload the armed watchdog.
Safety
Section titled “Safety”Writes the live watchdog counter and must use the timeout policy of its owner.
flint_watchdog_caused_reset
Section titled “flint_watchdog_caused_reset”unsafe fn flint_watchdog_caused_reset() -> boolWhether FlintOS armed the watchdog before the retained reset.
Safety
Section titled “Safety”Reads memory-mapped reason and scratch registers.
load_for_ms
Section titled “load_for_ms”const fn load_for_ms(timeout_ms: u32) -> u32Convert milliseconds to the RP2040-E1-adjusted counter load.
reset_reason
Section titled “reset_reason”unsafe fn reset_reason() -> u32Raw retained reason bits: timer is bit 0 and forced reset is bit 1.
Safety
Section titled “Safety”Reads a memory-mapped hardware register.
reset_reason_name
Section titled “reset_reason_name”const fn reset_reason_name(reason: u32) -> &'static strConstants
Section titled “Constants”FLINT_PANIC_REBOOT_MARKER
Section titled “FLINT_PANIC_REBOOT_MARKER”const FLINT_PANIC_REBOOT_MARKER: u32;Requests one direct flash reboot so a panic snapshot remains in SRAM.
FLINT_WATCHDOG_MARKER
Section titled “FLINT_WATCHDOG_MARKER”const FLINT_WATCHDOG_MARKER: u32;Pico SDK’s non-reboot marker. Its intentional reboot path clears this, which distinguishes a timeout from UF2 flashing and ROM USB reboot.