Outline
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
- FRDM-K64F board (Freescale Freedom Development Platform)
- Kinetis Design Studio V1.1.0.(Kinetis Design Studio Integrated Development)
- 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:
- GDB OpenOCD Debugging: this uses the OpenOCD to CMSIS-DAP debug protocol, available with OpenSDAv2.0 (FRDM-K64F) or OpenSDAv2.1 (FRDM-K22F)
- GDB PEMicro Interface Debugging: this can be used for any P&E device (Multilink, or OSJAT/OpenSDA P&E firmware on a Freescale board)
- GDB SEGGER J-Link Debugging: this can be used with any Segger device (J-Link, or OpenSDA J-Link firmware on a Freescale board)


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:


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:


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:


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


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:


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


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


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:


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


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 :-(


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):


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:


Because the board is already running a debug session:


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


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-none-eabi-gdb.exe: this is the ARM GDB client, needed for the OpenOCD, Segger and P&E servers listed below
- openocd.exe: this is the OpenOCD GDB server
- pegdbserver_console.exe: this is the P&E GDB Server
- JLinkGDBServerCL.exe: this is the Segger GDB Server
If you see multiple zombies/instances like this: kill them:


Links