You are viewing an older revision! See the latest version
CMSIS DAP
Background¶
CMSIS (Cortex Microcontroller Software Interface Standard) enables consistent and simple software interfaces to the processor and the peripherals.
The mbed SDK rely on the CMSIS layer in order to have a common API across different processors.
The CMSIS layer provides different components such as:
- CMSIS-CORE: provides a consistent interface to Cortex-M processors.
- CMSIS-DSP: suite of common signal processing functions for use on Cortex-M processors
- CMSIS-RTOS: standardized API for RTOS (Real-Time Operating Systems)
CMSIS-DAP¶
Recently ARM introduced a new component in the CMSIS layer: CMSIS-DAP.
It provides a standardized way to access the Debug Access Port (DAP) of a target. CMSIS-DAP is implemented on an Interface Chip. This Interface Chip is connected over USB to a debugger running on a host computer and over JTAG (Joint Test Action Group) or SWD (Serial Wire Debug) to the target device. JTAG and SWD are two common ways to debug a target.
You can access the documentation on the ARM website. You will need to register for an ARM silver account to access the documentation.
Why the need for CMSIS-DAP ?¶
There are several reasons concerning the introduction of CMSIS-DAP:
- Before the CMSIS-DAP standard, a lot of USB wigglers was implementing their own protocol. With this configuration the host debugger has to be aware of all these different protocols and has to implement all of them. This introduced a lot of fragmentation. CMSIS-DAP provides a standardized interface for debuggers
- With the new CMSIS-DAP layer, the host debugger can debug targets over SWD or JTAG without the need to implement these two protocols
- The USB connection uses the HID driver class. As HID drivers are built-in in every Operating Systems, there is no need for a specific driver to be installed on the host computer
How CMSIS-DAP can be integrated ?¶
As mentionned earlier, CMSIS-DAP has to be implemented on an Interface Chip. This chip does the link between the host computer (over USB for instance) and the target that has to be debugged (over SWD or JTAG).
On the mbed hardware, the CMSIS-DAP firmware has been implemented on the mbed interface. In addition to the Mass Storage and the Virtual Serial port interfaces, a HID endpoint is used to establish a CMSIS-DAP communication with a debugger.
Overview of the CMSIS-DAP standard¶
Packets are exchanged between the host debugger and the Interface Chip. Basically, the host sends a command and the debug unit sends the response of the command.
Different types of commands can be issued by the host:
- General Commands: request information and control the debug unit. Also used to connect/disconnect the debug unit.
- Common SWD/JTAG commands: used for instance to set the clock speed
- SWD specific commands: configure the parameters for SWD mode
- JTAG specific commands: configure the JTAG device chain
- Transfer Commands: read/write CoreSight registers. These commands are independent of the transport (SWD or JTAG)
Example: read memory over CMSIS-DAP¶
Let's say that a debugger needs to read the value at a specific location in memory. The following commands have to be sent by the host:
- Transfer Command: write the CSW register (Control/Status Word Register). This will configure the transfer (32bits/16bits/8bits transfer)
- Transfer Command: write the TAR register (Transfer Address Register) with the address of the memory location
- Transfer Command: read the DRW register (Data Read/Write register) to read the value at the location specified earlier
Conclusion¶
CMSIS-DAP provides a standardized interface for debuggers. It will probably become the de-facto stantard which debuggers and debug units will implement. This is why mbed chose to take advantage of this new standard to provide debug capabilities. For instance Keil uVision which combines an IDE, debugger and simulation environment already supports CMSIS-DAP. To try the new mbed interface with CMSIS-DAP, visit this page for more details :