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
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:
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:
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:
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):
If you see multiple zombies/instances like this: kill them:
I just thought it might be useful to describe the above process as applied to creating a GDB launcher for a USBDM debug interface.
USBDM: USBDM Debugger interface for Freescale RS08,HCS08,HCS12,Coldfire and ARM-Kinetis Devices.
Note that this process is not necessary if you create a project using the USBDM new project wizard.
Assumes the following:
Comments about troubleshooting given in Erich's posting should be equally useful with USBDM launches.
Why is it always necessary to terminate the last debugging session before starting a new one. This is not the way it was in Code Warrior. Is there anyway to workaround this or fix this?
Hi David,
It is a problem how Eclipse GDB launches the debug session, or how the started session checks if it is already running. This needs to be done at the plugin level. CodeWarrior has it implemented as it is using its own debug engine.
Normal GDB launcher plugins do not check this.
I'm only aware that the GNU ARM Eclipse one (which is in KDS v3.0.0) can check if there is already a debug session running, and offers this dialog:
But it is for Segger J-Link only (P&E and OpenOCD have not implemented that (yet?)).
So the workaround is to use J-Link in that case. For P&E or OpenOCD you have to terminate the debug session first.
Erich