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,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
Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments