fix(rp2): disable DBGPAUSE on startup

This commit is contained in:
Michael Smith
2025-09-16 17:48:45 -04:00
committed by Ron Evans
parent 0dca016749
commit 5d8afa25b8
2 changed files with 16 additions and 0 deletions
+4
View File
@@ -58,6 +58,10 @@ func machineInit() {
// Peripheral clocks should now all be running
unresetBlockWait(RESETS_RESET_Msk)
// DBGPAUSE pauses the timer when a debugger is connected. This prevents
// sleep functions from ever returning, so disable it.
timer.setDbgPause(false)
}
//go:linkname ticks runtime.machineTicks
+12
View File
@@ -101,3 +101,15 @@ func (tmr *timerType) lightSleep(us uint64) {
// Disable interrupt
intr.Disable()
}
// setDbgPause sets whether this timer is paused when a debugger is connected.
func (tmr *timerType) setDbgPause(enable bool) {
const bitPos = 1
const bitMask = 0b11
val := uint32(0b00)
if enable {
// Disable timer when debugger is connected to either core.
val = 0b11
}
tmr.dbgPause.ReplaceBits(val, bitMask, bitPos)
}