The ARM Debug Access Port (DAP) is an interface that provides debug access to ARM processor cores. It allows debugging tools like GDB to communicate with the processor core and perform debugging operations like halting execution, reading and writing registers and memory, and single stepping through instructions.
Overview of the ARM Debug Access Port
The DAP provides a standard way for debugging tools to access ARM cores without needing to know the details of the system the core is integrated into. This makes it easier to retarget debugging tools to different ARM-based chips.
The DAP uses a JTAG interface, so it is sometimes referred to as JTAG debugging. But whereas JTAG is a general purpose interface that could be used for things other than debugging, the DAP is dedicated to debug access.
The DAP has two main components:
- Debug Access Port Transport (DAPT): Provides the interface between the debugger and the chip’s debugging circuitry. This handles the low-level JTAG signaling and data transfer.
- Access Port (AP): Allows access to specific debugging components like processor cores. A chip will typically have at least one AP per processor core.
The AP allows debug access to components like:
- Core registers
- Breakpoint registers
- Watchpoint registers
- Debug control registers
- Memory access
The AP provides atomic operations so that these components can be safely accessed even while the processor is running.
DAP Implementations
There are several different versions and implementations of the DAP:
ARM DAPv1
The original DAP specification provided a basic debug interface for ARM7 and ARM9 cores. It includes:
- A JTAG Debug Port (JDP) for communicating with the debugger
- A Debug Access Port (DAP) for accessing the processor core
This provides a simple way to access the processor core registers and memory while debugging.
ARM DAPv2
An enhanced version that added support for:
- Managing debug authentication
- Accessing multiple APs
- Memory mapped access to APs
This allows debugging more complex multi-core and multi-processor systems.
ARM CoreSight DAP
CoreSight is ARM’s platform for debug and trace hardware built around the DAP interface. CoreSight DAP implementations include:
- JTAG-DP: JTAG Debug Port
- SW-DP: Single-Wire Debug Port, a two-pin serial version of the JTAG-DP
- SWJ-DP: Serial Wire JTAG Debug Port, which combines JTAG and SWD
These provide debug access in ARM CoreSight compliant systems.
CMSIS-DAP
The Cortex Microcontroller Software Interface Standard – Debug Access Port (CMSIS-DAP) is a specification for DAP implementations that connect ARM cores to a USB host in embedded systems. This allows easy debugging via USB without needing extra debug hardware.
Many low cost development boards include a CMSIS-DAP compatible debug interface chip to make it easy to connect to a computer and start debugging.
Using the Debug Access Port
The DAP provides an interface for tools to access ARM cores, but by itself does not provide high-level debugging functionality. Debuggers and other tools are needed to leverage the DAP capabilities.
For example, GDB communicates with the DAP to control execution and access registers and memory on the processor. IDEs and other tools likewise use the DAP interface for debugging tasks.
Using the DAP for debugging typically involves:
- Connecting to the DAP hardware interface (JTAG, SWD, USB, etc).
- Initializing the DAP and accessing the debug AP.
- Querying the DAP and AP capabilities.
- Attaching to the core(s) to be debugged.
- Using the DAP to halt, resume, step cores and access their state while debugging.
Software drivers and libraries like CMSIS-DAP handle the low level signaling and provide an API to access the DAP capabilities. Debugger frontends and IDEs build on these APIs to allow controlling debugging via the DAP.
Example Debug Session
A typical debug session using the DAP may involve:
- Connect to the target board via JTAG, SWD, or USB interface.
- Open the debugger and configure it for the target.
- Initialize the DAP and connect to the core’s AP.
- Reset and halt the core before the first instruction.
- Set breakpoint(s) at code location(s) of interest.
- Let the core run until a breakpoint is hit.
- Examine core registers, memory, variables, etc.
- Step through code line by line while monitoring state.
- Go back to setting new breakpoints, running, and debugging as needed.
The DAP provides the low-level interface for the debugger to control the chip and processor. The debugger software provides the user interface and higher level debugging capabilities during a debug session.
DAP Advantages for Debugging
Using the ARM Debug Access Port for debugging and development provides several benefits:
- Standardized interface – The DAP provides a standardized way to access debug components on ARM chips. This enables reuse of debugger software across ARM-based designs.
- Processor and system agnostic – Debug tools don’t need to know the details of the ARM chip or system, just the DAP interface. This makes them easy to retarget to new hardware.
- Atomic access – The DAP ensures safe atomic access to debug components, even while the processor is running.
- Optimized for debugging – Since it is dedicated for debug, the DAP provides capabilities tailored specifically for debugging needs.
- Efficient – The DAP provides fast debug access without disrupting real-time system operation when halting or stepping cores.
- Flexible – DAP implementations using JTAG, SWD, USB, etc. allow interfacing with various hosts and platforms.
By leveraging the DAP, developers can start debugging ARM-based designs faster and efficiently access on-chip debugging components. The DAP helps enable a robust ecosystem of portable ARM debug tools.
Conclusion
The ARM Debug Access Port provides a standardized interface to access the debugging components on ARM processors. It enables debugger tools to halt, control, and monitor ARM cores without needing intimate knowledge of the target system.
The DAP’s atomic access, optimized debug features, and flexibility have made it the interface of choice for ARM debugging. DAP implementations like CoreSight and CMSIS-DAP further extend its capabilities. By offloading the debug interface complexities onto the DAP, tool providers can focus on high-level debugging utilities for a wide range of ARM-based designs.