Difference between revisions of "DCC"

From SEGGER Wiki
Jump to: navigation, search
(Created page with "Category:Knowledge Base The Debug Communication Channel (DCC) is available on ARM7/ARM8/ARM11 and Cortex-A/Cortex-R processors. It can be used to enable transfer of data...")
 
m
Line 1: Line 1:
 
[[Category:Knowledge Base]]
 
[[Category:Knowledge Base]]
   
The Debug Communication Channel (DCC) is available on ARM7/ARM8/ARM11 and Cortex-A/Cortex-R processors.
+
The Debug Communication Channel (DCC) is a simply communication mechanism which allows the debug probe to communicate
  +
with the program running on the target processor, using the debug interface (typically JTAG).
It can be used to enable transfer of data between the target device and the debugger.
 
  +
In contrast to [[semihosting]], which halts the target CPU, it allows communication with the
  +
processor without halting the program.
  +
Communication is bidirectional.
  +
== Supported devices ==
  +
DCC is available on ARM7/ARM9/ARM11 and Cortex-A/Cortex-R processors.
  +
Similar mechanisms have been introduced by other silicon vendors for their cores.
   
  +
== Implementation ==
The DCC is implemented in coprocessor 14 and contains three registers:
 
  +
DCC is implemented in what ARM calls "coprocessor 14" and contains three registers:
* A 32-bit read register
 
  +
* A 32-bit read register, used to transfer data down from debugger to the target, so read from target, written via debug interface
* A 32-bit write register
 
* A 32-bit control register (where two bits are used).
+
* A 32-bit write register, used to transfer data up to the debugger, so written from target
  +
* A 32-bit control register (Where two bits are used, a 1 indicating that data is available). Set on write
   
 
The target application can send data to the debugger using the write register.
 
The target application can send data to the debugger using the write register.
 
When a word is loaded into the register, the W bit in the control register is set to notify the debug probe / debugger.
 
When a word is loaded into the register, the W bit in the control register is set to notify the debug probe / debugger.
The debugger reads the write register and clears the W bit to make the write register available again.
+
The debugger reads the write register, which automatically the W bit.
   
 
The target application can read data from the debugger using the read register.
 
The target application can read data from the debugger using the read register.
Line 17: Line 24:
 
When the target application reads the read register, the R bit is cleared again.
 
When the target application reads the read register, the R bit is cleared again.
   
  +
=== Interrupts ===
 
The target application can poll the R and W bit of the control register to check whether it can send or receive data.
 
The target application can poll the R and W bit of the control register to check whether it can send or receive data.
Alternatively changes of the bits can be made available as COMMRX and COMMTX interrupts to enable more efficient interrupt-driven communication.
+
Alternatively, changes of the bits can be made available as COMMRX and COMMTX interrupts to enable more efficient interrupt-driven communication. However, interrupts are rarley used in combination with DCC as they introduce additional complexity and are not available on all cores.
   
  +
== Protocol ==
 
DCC can be used to transfer any kind of data while the target CPU is running.
 
DCC can be used to transfer any kind of data while the target CPU is running.
  +
Unfortunately, ARM failed to suggest a standard communication protocol.
  +
DCC can be used with J-Link debug probes in different ways. It is completely up to the application programmer which data
  +
he wants to transfer. The application programmer is free to define is own protocol and can use J-Link to read the data on the host side.
  +
 
It is most commonly used for debug printf output or for system information, such as in embOS View.
 
It is most commonly used for debug printf output or for system information, such as in embOS View.
 
Although DCC provides a way for the debugger to communicate with the target application without halting it, DCC can add a lot overhead to the target application and affect the runtime behavior.
 
As the DCC registers are only 32-bit wide, only one word can be transferred at a time.
 
For more data to be output, the data needs to be buffered and the status of the W bit needs to be monitored, resulting in memory use and computing overhead.
 
 
A communication protocol is not defined. Target application and debugger need to use the same implementation of a protocol to communicate according to what DCC should be used for.
 
In most cases DCC can only be used for one purpose. The target application cannot send printf output and system data if not designed into one protocol.
 

Revision as of 15:06, 5 September 2019


The Debug Communication Channel (DCC) is a simply communication mechanism which allows the debug probe to communicate with the program running on the target processor, using the debug interface (typically JTAG). In contrast to semihosting, which halts the target CPU, it allows communication with the processor without halting the program. Communication is bidirectional.

Supported devices

DCC is available on ARM7/ARM9/ARM11 and Cortex-A/Cortex-R processors. Similar mechanisms have been introduced by other silicon vendors for their cores.

Implementation

DCC is implemented in what ARM calls "coprocessor 14" and contains three registers:

  • A 32-bit read register, used to transfer data down from debugger to the target, so read from target, written via debug interface
  • A 32-bit write register, used to transfer data up to the debugger, so written from target
  • A 32-bit control register (Where two bits are used, a 1 indicating that data is available). Set on write

The target application can send data to the debugger using the write register. When a word is loaded into the register, the W bit in the control register is set to notify the debug probe / debugger. The debugger reads the write register, which automatically the W bit.

The target application can read data from the debugger using the read register. The debugger can write a word to the read register and set the R bit in the control register to notify the target application. When the target application reads the read register, the R bit is cleared again.

Interrupts

The target application can poll the R and W bit of the control register to check whether it can send or receive data. Alternatively, changes of the bits can be made available as COMMRX and COMMTX interrupts to enable more efficient interrupt-driven communication. However, interrupts are rarley used in combination with DCC as they introduce additional complexity and are not available on all cores.

Protocol

DCC can be used to transfer any kind of data while the target CPU is running. Unfortunately, ARM failed to suggest a standard communication protocol. DCC can be used with J-Link debug probes in different ways. It is completely up to the application programmer which data he wants to transfer. The application programmer is free to define is own protocol and can use J-Link to read the data on the host side.

It is most commonly used for debug printf output or for system information, such as in embOS View.