Full debugging interface on mbed-enabled platforms!


800

We are pleased to announce we have added CMSIS-DAP support to the mbed HDK firmware for the following targets:

  • mbed NXP LPC1768
  • mbed NXP LPC11U24
  • FRDM-KL25Z

The new firmware upgrade, in addition to a drag n drop flash programming and a virtual serial port interface, provide a CMSIS-DAP interface in order to fully debug your platform for tools that support the CMSIS-DAP protocol.

This, combined with the exporting to toolchain features, means if and when you transition to a full debug toolchain as part of productisation, you don't need to change your hardware to:

  • set breakpoints to stop the program at some event or at a specified instruction to examine the current state
  • step by step execute a program to track the control flow
  • check variables values
  • inspect and modify memory contents

You can now upgrade your board very easily to support full CMSIS-DAP debug. Just select your board and follow the instructions:

Whilst the Online IDE doesn't support a debugger, here is an example of using this new feature with uVision MDK:

In this post, I would like to explain in more detail how CMSIS-DAP works.

What is CMSIS-DAP?

CMSIS-DAP provides a standardized way to access the Coresight Debug Access Port (DAP) of an ARM Cortex microcontroller via USB. CMSIS-DAP is generally implemented as an on-board interface chip, providing direct USB connection from a development board to a debugger running on a host computer on one side, and over JTAG (Joint Test Action Group) or SWD (Serial Wire Debug) to the target device to access the Coresight DAP on the other.

Why the need for CMSIS-DAP?

Before the CMSIS-DAP standard, a lot of USB wigglers implemented their own protocols. With this configuration, the host debugger has to be aware of these different protocols and has to implement all of them, which produces a lot of fragmentation and re-inventing the wheel. At the same time, the protocols were usually defined at the JTAG level, meaning they are slow. CMSIS-DAP provides a standardised interface for debuggers that is defined at the Coresight DAP level, allowing for a standard interface and fast driverless implementations.

How CMSIS-DAP can be integrated?

The CMSIS-DAP firmware has been implemented as part of the mbed HDK. In addition to the existing Mass Storage and the Virtual Serial port interfaces, a new HID endpoint is used to establish a CMSIS-DAP communication with a debugger. We chose to use a HID communication as HID drivers are built-in in all Operating Systems, there is no need for a specific driver to be installed on the host computer.

/media/uploads/samux/cmsis-dap-6.png

This means all mbed-enabled boards now have CMSIS-DAP built in (even ones already sold via a firmware upgrade), and if you implement the mbed HDK as part of your own development board or product, CMSIS-DAP will be freely available on that too!

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

Use CMSIS-DAP to debug your projects

To use it, you just need to update the firmware on your board (don't worry, it is easily upgraded and reverted) and connect with a CMSIS-DAP compliant toolchain. We've been using MDK as one of our test toolchains which has CMSIS-DAP support in it publicly from MDK uVision 4.60. To find out more about enabling your board with CMSIS-DAP, installing Keil MDK and debugging your first applications, please see the following page:

We'll be announcing more supported toolchains and scripts as they become available!

9 comments on Full debugging interface on mbed-enabled platforms!:

02 Apr 2013

Hi Samuel

What happened to the reference to pyOCD?

http://mbed.org/blog/entry/Debugging-from-GDB-using-pyOCD/

Thanks
Daniel

EDIT It's appeared again now - thanks very much Samuel, looking forward to trying it with GCC!

03 Apr 2013

I just updated my mbed LPC11u24, tried it with Crossworks and it seems to work perfectly. Thank you, thank you, thank you!

I purchased my mbed assuming I could use it with Crossworks and my SWD adapter. I played with it for the first time yesterday and found that I could not and was rather disappointed.... and then you add CMSIS-DAP literally hours later... perfect timing!

24 Apr 2013

Hi all,

Just wondering if anyone has used Rowley Crossworks for ARM with the mbed? I had some success with it, but had problems compiling "Serial.h" and "LocalFileSystem.h".

I have written some details here: https://mbed.org/users/timothyteh/notebook/rowley-crossworks-evaluation/

@Daniel Goertzen: Maybe you have some idea on this because you seem to have setup a project using LPC11u24

Cheers,

Timothy

Hardware used: mbed LPC1768

10 Nov 2013

Hi,

I went through the setup procedure for my FRDM-KL25Z today (with windows vista7 Installed mbed_if_v2.0_frdm_kl25z.s19 into the KL25z. Installed mbedWinSerial_16466.exe drivers to the PC.

Exported a simple blinkyHelloworld program. The program exported ok and appears to have built ok.

It went very smooth up to the point where I tried to download the result of the compilation onto the KL25Z. I got the following popup:

/media/uploads/hallher379/failure_to_download.jpg

This is what my device(s) look like after doing the setup:

/media/uploads/hallher379/mbed_serial_after_cmsis-dp_install.jpg

The board shows up as 'mbed'.

Can you tell me what I might have overlooked, or how to solve the problem?

Thanks, Herschel

PS: I clicked on the popup, which took me to another, that said that the flash erase failed:

/media/uploads/hallher379/erase_failed.jpg

10 Nov 2013

Hershel, you need to select the cmsis-dap interface as the flash programmer device in uvision. You should also select the appropriate target device before compiling in uvision. Follow the link above for cmsis-dap with Keil MDK.

11 Nov 2013

Hi,

Maybe I didn't ask the right question. Does my problem have anything to do with when I installed the mbedWinSerial_16466.exe drivers to the PC (the drivers the links took me to). What is the reason that I don't have 3 usb devices? The MBED CMSIS-DAP device is not there (see above in my original question). If this is the problem, how can I fix it? If not, and it is improper setup of uvision, can you post a screen shot(s) of what I need to do?

Thanks so much for your help. Herschel

11 Nov 2013

First of all, what version of KEIL are you using? Share the version, I can install it and look at it. I have been using 4.60 and 4.71 without any problems.

In windows device manager, only serial port is shown.

Can you please ask this in the question section, we can start helping you there. Thank you.

Regards,
0xc0170

17 Dec 2013

Can anyone help getting my boards working under the Keil MDK 5 debugger?

I've got four FRDM-KL25Z boards, and a couple of FRDM-K20D50M boards.

I installed the P&E and MBED windows tools on my Windows XP VMWare VM.

All four of the FRDM-KL25Z boards had version 1.09 of the bootloader; I updated them to bootloader version 1.11 using the P&E Micro bootloader update. Then I loaded the new MBED application. All four of the boards work in the usual MBED mode (the USB MSD and CDC devices work fine). However, only one of the four is working under the Keil ARM debugger. The other three show "No debug unit device found" in the SW Device / SWDIO dialog.

The one FRDM-K20D50M board on which I updated the bootloader (and installed the P&E msd/debug/cdc app) is also working fine under Keil.

Here is the version information from the Keil IDE:

IDE-Version: µVision V5.0.5.15 Copyright (C) 2013 ARM Ltd and ARM Germany GmbH. All rights reserved.

Tool Version Numbers: Toolchain: MDK-ARM Professional Cortex-M only Version: 5.0.5.0 Toolchain Path: C:\Keil\ARM\ARMCC\bin\ C Compiler: Armcc.Exe V5.03.0.76 Assembler: Armasm.Exe V5.03.0.76 Linker/Locator: ArmLink.Exe V5.03.0.76 Librarian: ArmAr.Exe V5.03.0.76 Hex Converter: FromElf.Exe V5.03.0.76 CPU DLL: SARMCM3.DLL V5.0.5.0 Dialog DLL: DARMCM1.DLL V1.11.00.0 Target DLL: CMSIS_AGDI.dll V1.16.9.0 Dialog DLL: TARMCM1.DLL V1.08.00.0

11 Feb 2014

Are there plans to get the FRDM-KL46Z board export to uVision supported on mbed compiler?