File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,10 @@ func machineInit() {
58
58
59
59
// Peripheral clocks should now all be running
60
60
unresetBlockWait (RESETS_RESET_Msk )
61
+
62
+ // DBGPAUSE pauses the timer when a debugger is connected. This prevents
63
+ // sleep functions from ever returning, so disable it.
64
+ timer .setDbgPause (false )
61
65
}
62
66
63
67
//go:linkname ticks runtime.machineTicks
Original file line number Diff line number Diff line change @@ -101,3 +101,15 @@ func (tmr *timerType) lightSleep(us uint64) {
101
101
// Disable interrupt
102
102
intr .Disable ()
103
103
}
104
+
105
+ // setDbgPause sets whether this timer is paused when a debugger is connected.
106
+ func (tmr * timerType ) setDbgPause (enable bool ) {
107
+ const bitPos = 1
108
+ const bitMask = 0b11
109
+ val := uint32 (0b00 )
110
+ if enable {
111
+ // Disable timer when debugger is connected to either core.
112
+ val = 0b11
113
+ }
114
+ tmr .dbgPause .ReplaceBits (val , bitMask , bitPos )
115
+ }
You can’t perform that action at this time.
0 commit comments