CMSIS-DAP with IAR and the KL25Z Freedom Board

Beside of USBDM, there is another Open Source implementation of a debug interface for the Freedom Board OpenSDA: CMSIS-DAP.

CMSIS-DAP stands for ‘Cortex Microcontroller Software Interface Standard – Debug Access Port’) has been published by ARM Inc. With this, there is an open source alternative to proprietary implementation (e.g. P&E OpenSDA or Segger OpenSDA).
Beside of the ARM MDK IDE, CMSIS-DAP is supported by Coocox and IAR. And IAR is what I’m using in this post.

CMSIS-DAP Firmware for OpenSDA

The CMIS-DAP firmware sources are availble from ARM CMSIS-DAP: (requires registration). Unfortunately, this is set up to be compiled with the ARM/Keil MDK IDE :-(.

The good news is: the Freescale Quick Start Package includes a pre-built version of the firmware:

CMSIS-DAP_OpenSDA.s19 in FRDM-KL25Z_QSP,zip

CMSIS-DAP_OpenSDA.s19 in FRDM-KL25Z_QSP,zip

Download that zip file, then unpack the files. Updating the OpenSDA firmware follows the usual process:

  1. Power the FRDM-KL25Z with reset button pressed: green LED flashes.
  2. Copy the CMSIS-DAP_OpenSDA.s19 to the BOOTLOADER device.
  3. Repower the board without the reset button pressed.

Then the device should show up as ‘OpenSDA CMSIS-DAP’:

OpenSDA CMSIS-DAP

OpenSDA CMSIS-DAP

❗ CMSIS-DAP now does *not* support a virtual COM (USB CDC) port. Such a port is supported by the original P&E OpenSDA and as well by the USBDM OpenSDA.

CMSIS-DAP in IAR Embedded Workbench

Once I have a project in IAR, it is really simple to change it to use CMSIS-DAP. I use the menu Project > Options… and select CMSIS DAP as Driver:

CMSIS DAP Driver

CMSIS DAP Driver

Then the CMSIS-DAP is enabled, and it automatically has SWD (Single Wire Debug) selected:

CMSIS DAP settings in IAR

CMSIS DAP settings in IAR

That’s it! Now I can debug my application with CMSIS-DAP:

IAR Embedded Workbench IDE debugging with CMSIS-DAP and FRDM-KL25Z

IAR Embedded Workbench IDE debugging with CMSIS-DAP and FRDM-KL25Z

Summary

With the CMSIS-DAP I have another open source OpenSDA debug interface beside of USBDM. USBDM is supported by CodeWarrior, and CMSIS-DAP is supported by IAR/Keil/Coocox, so this makes it an attractive alternative for the ‘open source lovers’. The low-level bootloader of the OpenSDA is not Open Source, but with CMSIS-DAP the chances are good to have a fully open source run control hardware plus software for ARM cores. And that CMSIS-DAP would the de-facto standard to debug any ARM core. And mbed jumped on the CMSIS-DAP wagon already (see links below).

Happy DAPing 🙂

Links

22 thoughts on “CMSIS-DAP with IAR and the KL25Z Freedom Board

      • I tried to use the P&E one but could not get the licensing to work.

        The GDB server for USBDM worked well with Eclipse + codesourcery. Only it could not “Run to Line” – it could be my error though.

        I like the idea of a FOSS unlimited toolchain for small companies who need to save capital for hardware/tools rather than pay for more compiler seats.

        As an FAE I try lots of

        Like

        • As I have not looked into the P&E one: do you say the licensing terms did not work for you? Or is there any licensing enforcement which failed? I love FOSS tools, but at least to me it always a balance beween ‘do it yourself’ kind of thing or spending at least a few $ to get over that hump. I think with the great movement to ARM cores and the broad availability of vendors the prices already went down, or vendors are providing reasonable free limits. On the other side: some silicon vendors are affraid to give away their tools, because the ‘independent’ software tool vendors want to keep their business model. FOSS only works if there are people and users out there willing to spend their time and talent on this, with no or very limited return of investment. I guess the business model will change anyway.

          Like

  1. Pingback: Bricking and Recovering FRDM-KL25Z Boards: Reset, SWD Clock and Low Power | MCU on Eclipse

  2. Pingback: Using Keil µVision (ARM-MDK) with Processor Expert Driver Suite | MCU on Eclipse

  3. Pingback: DIY Free Toolchain for Kinetis: Part 3 – Debugger (GDB Server with P&E and Segger) | MCU on Eclipse

  4. Pingback: The Freescale OpenSDA Trap: “No Device Available”, or something like that…. | MCU on Eclipse

  5. Eric,
    1.) Can this be used in Freescale CodeWarrior (specifically CW10.2) with Kinetis MCU (specifically K10 ==> Cortex M4)?
    2.) Does this option provide the same debugging tools as the P&E Tracelink?

    Like

    • 1) Yes, you can use the IAR tools with K10 as well. It is very much the same (JTAG instead of SWD)
      2) For normal run control (setting breakpoints/etc) it is the same as P&E Tracelink. I have not measured the speed, but I feel that the P&E Tracelink is faster. But to my knowledge there is no trace support with CMSIS-DAP.

      Like

  6. Pingback: Using the FRDM-K64F with CodeWarrior | MCU on Eclipse

  7. Pingback: Segger J-Link Firmware for OpenSDAv2 | MCU on Eclipse

  8. Pingback: Using Kinetis Design Studio with IAR Embedded Workbench IDE | MCU on Eclipse

  9. Pingback: Using the Freescale Freedom (FRDM-KL43Z) to Debug other Boards | MCU on Eclipse

  10. At the time, I happily followed this and several other guides to make a CMSIS-DAP from my FRDM-KL25Z (bought it just to become CMSIS-DAP). While It works OK, I’ve found an even cheaper ($3.2) way:
    A programmer has ported the main part of CMSIS-DAP for STM32F103 so in short it’s here:
    https://github.com/x893/CMSIS-DAP
    There are also pre-compiled .hex files for those who can not compile it:
    https://github.com/x893/CMSIS-DAP/tree/master/Firmware/STM32/hex
    Now the cheap part: there is a $3 .. 3.40 board with stm32F103 on ebay, described here:
    https://github.com/palhartinger/HowTo-STM32F103C8T6/wiki/2_-Board-description.
    How to flash it – via the serial port (pin PA9 & PA10) using stm32flash under Linux. But first we convert the .hex to .bin:
    arm-none-eabi-objcopy -I ihex –output-target=binary CMSIS-DAP-STLINK21.hex CMSIS-DAP-STLINK21.bin
    Then we flash (boot0 jumper set at position 1, power-cycled to put MCU in serial bootloader mode):
    stm32flash -w CMSIS-DAP-STLINK21.bin -v -g 0x0 /dev/ttyUSB0

    Like

    • Hi Angel,
      Thanks for the links and the information provided!
      I have found the most difficult part for CMSIS-DAP is not to get a reasonable (or cheap) board. The problem is the quality of the flash programming/configuration files for boards and devices. It works ok for the more popular ones (e.g. FRDM-KL25Z), but as soon as another (less popular board or device) is used, in my experience it hardly works.
      Erich

      Like

  11. Hi,
    It is really helpfull.
    The prpoblem is that i made these steps but i become this error: “Fatal error: CPU did not power up Session aborted!” and i don’t know why.

    Any help?

    Thanks

    Like

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.