CMSIS DAP MDK

Current limitations

For the purpose of this trial, it will not be possible to debug applications that use semi-hosting calls to the mbed interface. Examples of these calls are :

  • Accessing the local file system
  • Ethernet applications where the MAC address is provided by the interface (default)
  • Accessing the power down functions of the interface

This is because the MDK does not currently support the use of semihosting calls.

Getting started

To try the mbed CMSIS-DAP upgrade you will need :

  • The firmware that supports CMSIS-DAP for your target
  • An offline tool that support CMSIS-DAP - Keil MDK v4.60 for example
  • An example project you wish to debug!

1. Upgrading your board

a - Select your board

Select your board and follow the upgrade process for your board:

b - Install the latest serial driver

c - Results

There will now be three mbed USB devices in device manager :

  • USB disk
  • mbed Serial port
  • mbed CMSIS-DAP

/media/uploads/chris/new-usb-device.png

Driver issue

If the serial is not recognised by the host:

  • go into the device manager
  • right click on "mbed composite"
  • uninstall the driver
  • then disconnect/connect your mbed
  • install the serial driver

2. Install an offline tool

The recommended offline tool is Keil MDK v4.60. Follow the links and instructions to set up the evaluation copy.

3. Export a project

┬ÁVision is one of the external offline toolchains supported by the mbed platform.

For a complete overview of the "export" feature, please refer to our general: Exporting to offline toolchains.

To export your mbed program for use in uVision, right-click the program in your program workspace. From the dialog, you can select the "Export To" as "Keil uVision4", and the target microcontroller you wish to export for.

When you choose export, a zip file containing all the files you need for uVision will be generated. Unzip it and open the uVision project file (In this case, "project.uvproj"):

/media/uploads/chris/uvision_1.png

4. Compile, download, debug!

Once you have unzipped and opened the ".uvproj" file, your project should appear in the uVision IDE much in the same way it appeared in the online compiler. You can browse the project files by navigating in the left panel, and the code will appear in the main panel.

4.1 Compile

When the project has successfully compiled, "fromelf" will automatically run, to extract a binary file. This could be drag and dropped onto the mbed flash disk.

/media/uploads/chris/uvision_compile.png

4.2 Download

With the CMSIS-DAP upgrade, clicking the download button within uVision will send the binary directly to the flash of the MCU

/media/uploads/chris/uvision_download.png

4.3 Debug

Add break points (1) by clicking on the line of code you wish to stop at, and use the "run" button (2) to execute the program until the break point it hit.

/media/uploads/chris/uvision_debug.png

The tools enable you to step in various ways over/into/out of

Use the tool bar to add registers, memory, call stack, symbol and watch windows. This gives visibility on the system status when a breakpoint is reached.

/media/uploads/chris/uvision_tools.png

5. Conclusion

A simple firmware upgrade of your board enables the on-board programming interface to communicate with debugging tools over the new CMSIS-DAP protocol. Over time we hope this will mean mbed will become interoperable with a wide range of offline tools, proving professional debug capabilities when they are needed.




4 related questions:


12 comments:

15 Dec 2012

Works great even with the <32K code size free demo MDK! I seemed to have to power cycle and reset my mbed twice after updating the mbed firmware before Windows ever saw it again and loaded the drivers.

15 Dec 2012

Can we get the source code of the firmware, it would be a banger if you do share else thumbs down :(

PS: Some of us use OpenBSD and therefore have no keil and we use asm please do make an exception for our kind.

Thank you.

15 Dec 2012

No install driver my windows 7 (64-bit) for "Serial Port". ( The same USB port speed slowly work with mbed NXP LPC1768. Rolled back to "mbedMicrocontroller_21164.if".

15 Dec 2012

Hi Denis,

After having updated your firmware, can you make sure that you run the latest serial driver. If you have further problems, can you try to uninstall the mbed composite device from the device manager, then plug your mbed with the new interface and run the serial driver.

This is a common problem on Windows as windows caches the drivers. As the two interfaces have the same vid/pid, windows tries to load the same driver and fails.

Cheers, Sam

15 Dec 2012

It don't work with cocoox ide :(

16 Dec 2012

Samuel Mokrani wrote:

After having updated your firmware, can you make sure that you run the latest serial driver. If you have further problems, can you try to uninstall the mbed composite device from the device manager, then plug your mbed with the new interface and run the serial driver.

This is a common problem on Windows as windows caches the drivers. As the two interfaces have the same vid/pid, windows tries to load the same driver and fails.

Thanks Samuel. The driver helped me, now the system has all the equipment. The problem with the speed of USB - not decided, I tried to remove the all device in device manager and re-connect the mbed.

Have a question: I have installed on the computer for a long time "Keil uVision4", but he did not seem to support "CMSIS DAP MDK". It is possible to separately install / configure without reinstalling "Keil"? As it there to add?

16 Dec 2012

Hi Denis,

Concerning the speed problem, can you try to use another usb cable ? another usb port ? another computer with the same cable ?

For MDK, I am afraid that you need to download the full version again.

Cheers, Sam

16 Dec 2012

Samuel Mokrani wrote:

Concerning the speed problem, can you try to use another usb cable ? another usb port ? another computer with the same cable ?

Tried to change the cable and port, but the system says that the device can run faster. If a return to the old firmware, no problems with the speed USB is not observed.

16 Dec 2012

This is great!

By this way we can use a very usefull debugger now. The debugging of my mbed project in Keil MDK V4.60 goes without any problems, but there is one little thing in the debugger to notice: I had some problems with watching local auto variables that appeared <out of scope> while a breakpoint was set somewhere in the function where the variables were declared. A solution for this is to rebuild the project with Keil compiler optimization on 0 (= no optimization) In a final project state you can switch back to level 2 again.

21 Dec 2012

Worked like a charm.

Small glitch in exporter detected, it won't export files with .hpp extension to Keil, had to rename to .h

Strange thing happened here. No serial.printf's would work after new firmware install. Reverted to last firmware and they came alive again.

Too tired to test more, just a warning here in case someone else stumbles upon this same thing.

20 May 2013

Matheus Almeida wrote:

It don't work with cocoox ide :(

I also had no luck trying to make it work with CooCox CoIDE...I believe there must be a workaround to make it work with CoIDE though..Hoping for opinions..

20 Dec 2013

Well, it's been a long time since the last message on this thread but I should put this here in case there is anyone interested: I have managed to get CMSIS-DAP interface of mbed (LPC1782) and CooCox CoIDE v1.7.5 to work together. The trick is to select "Debug in RAM" int the Link tab of Configuration menu. However debugging in RAM has its dangers. For example, in my case, I had to set VTOR to 0x10000000 again after ResetISR finished memory initialization, because it's value was zeroed during initialization of bss (I am talking about ResetISR of cr_startup_lpc17.c file that is generated from CoIDE repositories)

Elias Kyrlies-Chrysoulidis wrote:

Matheus Almeida wrote:

It don't work with cocoox ide :(

I also had no luck trying to make it work with CooCox CoIDE...I believe there must be a workaround to make it work with CoIDE though..Hoping for opinions..

Posting new comments for this page has been disabled