| |||
| Home > Debug > Debug registers > CP14 c1, Debug Status and Control Register (DSCR) | |||
The purpose of the Debug Status and Control Register (DSCR) is to:
provide status information about the state of the debug system
enable you to configure aspects of the debug system.
The DSCR is:
in CP14 c1
a 32-bit read/write register
fully accessible in privileged mode only:
If bit[12] of the register is clear (0), the register can be read from User mode. However it is never possible to write to this register from User mode.
Figure 13.4 shows the arrangement of bits in the register.
Table 13.6 shows the bit functions of the Debug Status and Control Register.
Table 13.6. Debug Status and Control Register bit field definitions
| Bit Range | Field Name | Core view | External view | Function | Reset value |
|---|---|---|---|---|---|
| [31] | - | - | - | Reserved, UNP/SBZP. | - |
| [30] | rDTRfull | R | R | Indicates the state of the DTR for read operations: 0 = rDTR empty 1 = rDTR full. This flag is automatically set on writes by the DBGTAP debugger to the rDTR and is cleared on reads by the core of the same register. When the rDTRfull flag is set (1), no writes to the rDTR are enabled. | 0 |
| [29] | wDTRfull | R | R | Indicates the state of the DTR for write operations: 0 = wDTR empty 1 = wDTR full. This flag is automatically cleared on reads by the DBGTAP debugger of the wDTR and is set on writes by the core to the same register. | 0 |
| [28:16] | - | - | - | Reserved, UNP/SBZP. | - |
| [15] | Monitor Mode Enable | RW | R | This bit is used to enable Monitor debug-mode: 0 = Monitor debug-mode disabled 1 = Monitor debug-mode enabled. For the core to take a debug exception, Monitor debug-mode has to be both selected and enabled (bit[14] clear and bit[15] set). | 0 |
| [14] | Mode Select | R | RW | This bit is used to select Monitor debug-mode: 0 = Monitor debug-mode selected 1 = Halt mode selected and enabled. See the description of the Monitor Mode Enable bit, above. | 0 |
| [13] | ARM | R | RW | This bit is used to enable the execution of ARM instructions: 0 = ARM instruction execution disabled 1 = ARM instruction execution enabled. When this bit is set, the core can be forced to execute ARM instructions in debug state using the Debug Test Access Port. NoteIf this bit is set when the core is not in debug state, the behavior of the ARM1136JF-S processor is Unpredictable. | 0 |
| [12] | Comms | RW | R | This bit controls User mode access to the comms channel: 0 = User mode access to comms channel enabled 1 = User mode access to comms channel disabled. If this bit is set and a User mode process tries to access the DIDR, DSCR, or the DTR, the Undefined instruction exception is taken.[1] | 0 |
| [11] | Interrupts | R | RW | This bit controls interrupts: 0 = Interrupts enabled 1 = Interrupts disabled. When set, the IRQ and FIQ input signals are inhibited.[2] | 0 |
| [10] | DbgAck | R | RW | If this bit is set, the DBGACK output signal (see External signals) is forced HIGH, regardless of the processor state.[2] | 0 |
| [9] | DbgNoPwrdwn | R | RW | Powerdown disable: 0 = DBGNOPWRDWN is LOW 1 = DBGNOPWRDWN is HIGH. See External signals. | 0 |
| [8] | - | - | - | Reserved, UNP/SBZP. | - |
| [7] | Sticky imprecise aborts | R | RC | This bit indicates that an imprecise Data Abort has occurred: 0 = No imprecise Data Aborts have occurred since the last time this bit was cleared 1 = An imprecise Data Abort has occurred since the last time this bit was cleared. This bit is cleared on reads of a DBGTAP debugger to the DSCR. | 0 |
| [6] | Sticky precise abort | R | RC | This bit indicates that a precise Data Abort has occurred: 0 = No precise Data Abort has occurred since the last time this bit was cleared 1 = A precise Data Abort has occurred since the last time this bit was cleared. This bit is cleared on reads of a DBGTAP debugger to the DSCR. NoteThis flag is provided to detect Data Aborts generated by instructions issued to the processor using the Debug Test Access Port. Therefore, if the DSCR[13] execute ARM instruction enable bit is 0, the value of the sticky precise abort bit is Unpredictable. | 0 |
| [5:2] | Entry | RW | R | This field shows the method of entry to debug state. See Table 13.7 for the allowed values and their meaning. | b0000 |
| [1] | Core restarted | R | R | This bit enables a debugger to check whether the processor has exited from debug state[3]: 0 = the processor is exiting debug state 1 = the processor has exited debug state. See Exiting from debug state for details of the use of this bit. | 1 |
| [0] | Core halted | R | R | This bit indicates when the processor is in debug state[3]: 0 = the processor is in normal state 1 = the processor is in debug state. After programming a debug event, the debugger polls this bit until it is set to 1 so it knows that the processor entered debug state. | 0 |
[1] Accessing other CP14 debug registers is never possible in User mode, see Executing CP14 debug instructions. This means that setting this bit means there is no User mode access to the CP14 debug registers. [2] Bits[11:10] of this register (DSCR[11:10]) can be controlled by a DBGTAP debugger to execute code in normal state as part of the debugging process. For example, if the DBGTAP debugger has to execute an OS service to bring a page from disk into memory, and then return to the application to see the effect this change of state produces, it is undesirable that interrupts are serviced during execution of this routine. [3] See Debug state for a definition of debug state. | |||||
The Entry field in the DSCR shows how debug state was entered. Table 13.7 gives the allowed values for this field.
Table 13.7. Entry field values, DSCR
| Entry value | Reason for entering debug |
|---|---|
| b0000 | A Halt DBGTAP instruction occurred |
| b0001 | A breakpoint occurred |
| b0010 | A watchpoint occurred |
| b0011 | A BKPT instruction occurred |
| b0100 | A EDBGRQ signal activation occurred |
| b0101 | A vector catch occurred |
| b0110 | A data-side abort occurred |
| b0111 | An instruction-side abort occurred |
| b1xxx | Reserved |
The Entry field, bits[5:2] of the DSCR, indicates:
the reason for jumping to the Prefetch or Data Abort vector
the reason for entering debug state.
A Prefetch Abort or a Data Abort handler will use these to determine if it must jump to the monitor target. Additionally, a DBGTAP debugger or monitor target can determine the specific debug event that caused the debug state or debug exception entry.
The Core halted bit of the DSCR, DSCR[0], can be read to check whether the processor is in normal or debug state. However, it might not be reliable for a debugger to use this bit to check for exit from debug state. This is because another debug event could cause debug state to be re-entered before the debugger has successfully polled DSCR[0] to check for a return from debug state. For this reason, the Core restarted bit, DSCR[1], is provided to enable reliable testing of exiting debug state. An example of the use of DSCR[1] illustrates this point.
After executing a DBGTAP IR instruction, the debugger polls the Core restarted bit until it is set to 1. At that point, the debugger knows that the IR instruction was effective, even if another debug event immediately causes re-entry to debug state.
Figure 13.5 shows the relationship between the Core restarted bit and the Core halted bit. In this illustration, almost as soon as the core has been restarted a breakpoint causes it to re-enter debug state. If the debugger was polling the Core restarted bit to check for exit from debug state it might miss the return to normal state, and conclude that the IR instruction had failed. However, in the illustration, the fact that the Core restarted signal has been reset to HIGH confirms that the IR instruction was successful.
Table 13.5 shows the results of attempted accesses to the Debug Status and Control Register for each mode.
Table 13.8. Results of accesses to the Debug Status and Control Register
| Privileged read | Privileged write | User read, DSCR[12][1]=0 | User read, DSCR[12][1]=1 | User write |
|---|---|---|---|---|
| Data read | Data write[2] | Data read | Undefined exception | Undefined exception |
[1] Bit[12] of the DSCR register. The value of this bit does not have any effect on any other mode of access to the Debug Status and Control Register. [2] Refer to Table 13.6 for details of which bits of the DSCR register can be written. | ||||
To access the Debug ID Register you read or write CP14 with:
Opcode_1 set to 0
CRn set to c0
CRm set to b0001
Opcode_2 set to 0.
For example:
MRC p14, 0, <Rd>, c0, 1, 0 ; Read Debug Status and Control Register
MCR p14, 0, <Rd>, c0, 1, 0 ; Write Debug Status and Control Register