Skip to content

Commit 26c264b

Browse files
committed
fix(rp2): disable DBGPAUSE on startup
1 parent 3ddba4e commit 26c264b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/machine/machine_rp2.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ func machineInit() {
5858

5959
// Peripheral clocks should now all be running
6060
unresetBlockWait(RESETS_RESET_Msk)
61+
62+
// Disable pausing the main timer when a debugger is attached. This
63+
// prevents sleep functions from ever returning if a debugger is
64+
// attached.
65+
timer.setDbgPause(false)
6166
}
6267

6368
//go:linkname ticks runtime.machineTicks

src/machine/machine_rp2_timer.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,14 @@ func (tmr *timerType) lightSleep(us uint64) {
101101
// Disable interrupt
102102
intr.Disable()
103103
}
104+
105+
// setDbgPause sets whether this timer is paused when a debugger is connected.
106+
func (tmr *timerType) setDbgPause(enable bool) {
107+
const bitPosCore0 = 1
108+
const bitMask = 0b11
109+
var val uint32
110+
if enable {
111+
val = 0b11
112+
}
113+
tmr.dbgPause.ReplaceBits(val, bitMask, bitPosCore0)
114+
}

0 commit comments

Comments
 (0)