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() {
5858
5959 // Peripheral clocks should now all be running
6060 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 )
6165}
6266
6367//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) {
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 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