6.5.8.4.13 Single Step

A debugger can use debug monitor stepping to return from the Debug Monitor exception handler, execute a single instruction, and then re-enter the Debug Monitor exception handler. Debug monitor stepping is active when all of the following conditions are met:

  • DHCSR.C_DEBUGEN is set to ‘0’ (halting debug disabled)
  • DEMCR.MON_EN is set to ‘1’ (monitor debug enabled)
  • DEMCR.MON_STEP is set to ‘1’ (monitor stepping enabled)
  • The execution priority is below the priority of the Debug Monitor exception

Reference: ARM DDI 0403E.b, C1.5.1 Debug stepping

Table 6-39. Single Step Sequence
Stepsrddi_dap
WriteD32(DHCSR, (DBGKEY | C_MASKINTS | C_HALT | C_DEBUGEN))
WriteD32(DHCSR, (DBGKEY | C_MASKINTS | C_STEP | C_DEBUGEN))
WriteD32(DHCSR, (DBGKEY | C_HALT | C_DEBUGEN))