7.5.14 Single Step
To single step CPU instructions, a debugger needs to:
- Ensure the CPU is in the Debug state by reading the DHCSR.S_HALT bit and place the CPU in the Debug state if this is not the case
- Write DHCSR = C_MASKINTS | C_STEP | C_DEBUGEN
- Write DHCSR = C_MASKINTS | C_HALT | C_DEBUGEN
For more details, refer to the ARMv7-M Architecture Reference Manual - ARM DDI 0403E, C1.5.1 Debug stepping.
Steps | Commands |
---|---|
Single step | WriteD32(DHCSR, DBGKEY | C_MASKINTS | C_STEP | C_DEBUGEN) |
Ensure halt after step | WriteD32(DHCSR, DBGKEY | C_MASKINTS | C_HALT | C_DEBUGEN) |