7.5.7 Get Core Register

To transfer a data word from an ARM core register, special-purpose register or floating-point extension register, a debugger:

  • Ensures the CPU is in the Debug state by reading DHCSR.S_HALT bit and places the CPU in the Debug state if this is not the case.
  • Writes to the DCRSR with the REGSEL value indicating the required register and the REGWnR bit as 0 to indicate a read access. This write clears the DHCSR.S_REGRDY bit to 0.
  • Polls DHCSR until DHCSR.S_REGRDY reads as 1. This shows that the processor has transferred the value of the selected register to DCRDR.
  • Reads the required value from DCRDR.

For more details, refer to the ARMv7-M Architecture Reference Manual - ARM DDI 0403E, C1.6.3 Debug Core Register Selector Register, DCRSR.

Table 7-9. Reference
StepsCommands
Write REGSELWriteD32 (DCRSR, RegSel)
Poll DHCSR for S_REGRDYS_REGRDY = 1
Read value from DCRDRReadD32 (DCRDR, value)
Table 7-10. Where RegSel Is One of the CPU Registers
Register NameCoreReg
R00
R11
....
R1212
SP13
LR14
PC15
xPSR16
....
Note: For complete table details, refer to the Arch Manual C1.6.3 Debug Core Register Selector Register, DCRSR.