Skip to main content

Crate arm_dcc

Crate arm_dcc 

Source
Expand description

§Debug Communication Channel (DCC) API

The Debug Communications Channel is a mechanism to get data from a target and into a host, and vice-versa. It works over a JTAG interface and so does not require a UART, or any dedicated I/O pins, and it does not stop the CPU whilst being used (unlike semihosting).

DCC was added to the Arm Architecture Reference Manual in ARMv7. Before that it was defined separately, usually as part of the Debug hardware in a specific ARM processor’s Technical Reference Manual (like for the ARM7TDMI).

This crate supports:

  • AArch64
  • ARMv7 AArch32
  • legacy ARM AArch32

§Example

§Device side

use arm_dcc::dprintln;

fn main() {
    dprintln!("Hello, world!");
}

§Host side

§Xilinx System Debugger

$ xsdb

xsdb% # connect
xsdb% conn

xsdb% # select a Cortex-R core
xsdb% targets -set 0

xsdb% # hold the processor in reset state
xsdb% rst -processor

xsdb% # load program
xsdb% dow hello.elf

xsdb% # open a file
xsdb% set f [open dcc.log w]

xsdb% # redirect DCC output to file handle `f`
xsdb% readjtaguart -start -handle $f

xsdb% # start program execution
xsdb% con
$ # on another terminal
$ tail -f dcc.log
Hello, world!

Run J-Link:

$ JLinkExe
SEGGER J-Link Commander V9.48 (Compiled Jun  3 2026 14:21:00)
DLL version V9.48, compiled Jun  3 2026 14:20:18

Connecting to J-Link ...O.K.

Type "connect" to establish a target connection, '?' for help
J-Link>device LPC2138
J-Link>si JTAG
J-Link>speed 1000
J-Link>jtagconf -1,-1
J-Link>connect
J-Link>r
J-Link>h
J-Link>loadfile target/file.hex
J-Link>go
J-Link>term
Please select terminal protocol:
B) Binary (raw) data (Default)
D) SEGGER DCC terminal
Protocol>D
Hello, world!

The term command activates the DCC terminal. Select ‘D’ for a DCC terminal. We don’t implement the SEGGER DCC Terminal protocol, but JLink doesn’t seem to mind.

§Supported Rust version

  • Rust >=1.59

§Optional features

§nop

Turns dcc::write into a “no-operation” (not the instruction). This is useful when the DCC is disabled as dcc::write blocks forever in that case.

§legacy-mode

By default this crate uses the ARMv7 DCC registers (when target_arch = "arm"). This feature selects the debug registers for the ARM7TDMI and ARM9EJ-S instead.

Macros§

dprint
Macro for printing to the DCC
dprintln
Macro for printing to the DCC, with a newline.

Structs§

Writer
Proxy struct that implements the fmt::Write

Functions§

write
Writes a single word to the DCC
write_all
Writes the bytes to the DCC
write_str
Writes the string to the DCC