GDB Debugging with Kinetis Design Studio

Document created by Erich Styger Employee on Aug 11, 2014Last modified by Diana Torres on Feb 28, 2017
Version 10Show Document
  • View in full screen mode


How to start debugging with the GDB debugging in KDS. If you are coming from CodeWarrior, then debugging with KDS is somewhat different because of the nature of GDB, and because the debug configuration panels look different.


This document uses

  1. FRDM-K64F board (Freescale Freedom Development Platform)
  2. Kinetis Design Studio V1.1.0.(Kinetis Design Studio Integrated Development)
  3. Screenshots from Windows 7 host (but things are very similar to any other host supported)


Creating Debug Configuration

In order to debug, a debug configuration needs to be created. It is assumed that you already have compiled/linked your project at this time.


In order to have most fields of the debug configuration pre-populated, select the project in the Project Explorer view:


Select the menu Run > Debug Configuration:

Alternatively, the debug icon drop down list can be used:

Kinetis Design Studio supports three different debugging connections:

  1. GDB OpenOCD Debugging: this uses the OpenOCD to CMSIS-DAP debug protocol, available with OpenSDAv2.0 (FRDM-K64F) or OpenSDAv2.1 (FRDM-K22F)
  2. GDB PEMicro Interface Debugging: this can be used for any P&E device (Multilink, or OSJAT/OpenSDA P&E firmware on a Freescale board)
  3. GDB SEGGER J-Link Debugging: this can be used with any Segger device (J-Link, or OpenSDA J-Link firmware on a Freescale board)

GDB Debug Launch Configurations.png

Once the configuration is created, I recommend to name it according t

Double click on one of the entries to create a new configuration for it. Instead double clicking you can use the 'New' icon as well:

Click and Create.png

What I recommend is to name the debug configuration. So I know later which configuration is for what. What I'm using is <project name><connection> like below:

Naming Debug Configurations.png

Another thing I highly recommend is to save the debug configuration as file in the project (.launch). This allows sharing or passing the debug configuration with the project files.

To do this, I have 'Shared file' enabled:

Sharing Debug Configuration.png

That way the launch configuration files are stored in the project:

Launch Config Files in project.png


Then I need to fill out the fields for the debug configuration.

The details are listed in DS Debug Configurations (OpenOCD, P&E, Segger), and listed here again:


For OpenOCD, use "-f kinetis.cfg" which is the same for all Kinetis devices:

OpenOCD config.png


For P&E: select the interface, port and device:

PnE Settings.png


For Segger, specify device name, interface (use JTAG only if you know the debug header supports JTAG. If in doubt, choose SWD):

Segger Debug Settings.png

SWO (Single Wire Output) is an extra pin to SWD/JTAG, and currently not supported on FRDM boards. So I disable that option for my FRDM boards, as otherwise the debugger will complain later about it:

Segger Startup Settings.png


Debugging and Debug Icon

To Debug, one way is to use the 'Debug' button from the Debug Configuration dialog:

Debug Button.png

You have to do this at least once.

Once you have done that, then you can use the drop down of the Debug icon:

Just pressing the 'Debug' Icon is in general NOT recommended if it does not show in the tooltip a launch configuration:

And if you get the dialog below:

DO NOT select either gdbserver or remote gdb/mi: it does not work that way :-(

Launch Debug Configuration Selection which is a dead end.png

Press Cancel, and select it from the list, or select it from the 'Debug Configurations...' dialog:


Although KDS V1.1.0 has improved in this area, it is possible that it will show you a selection of launch/debug configurations (then you are ok to choose one):

Launch Configuration Selection.png

The recommended way is to use the drop down list and to select the desired debug/launch configuration:



Trouble Shooting

If debugging does not work, here are a few trouble shooting tips:


Settings: verify that your launch configuration settiings are ok. That you are debugging the correct board with the correct connection (P&E, OpenOCD, Segger).


Power: Verify that your board has power and connected with the correct USB port on the board.


Not Debugging Twice: Make sure that you are *not* debugging the same application board twice, or you will get this:

Failed to Debug debugging target twice.png

Because the board is already running a debug session:

Tried to debug twice.png

Always terminate an existing debug session before starting a new one:

Terminate Debug Session.png

Kill any Zombies: the gdb client and server are usually terminated after a debug session. After terminating a debug session, verify that these services are *not* present any more in your task manager (Windows):

ARM GDB Client.png

  1. arm-none-eabi-gdb.exe: this is the ARM GDB client, needed for the OpenOCD, Segger and P&E servers listed below
  2. openocd.exe: this is the OpenOCD GDB server
  3. pegdbserver_console.exe: this is the P&E GDB Server
  4. JLinkGDBServerCL.exe: this is the Segger GDB Server

If you see multiple zombies/instances like this: kill them:

gdb Zombies.png