Eclipse/CDT for eCos application development
Prev |  |

# Debugging eCos applications

## Setup

Prior to debugging an eCos application, it is necessary to generate a suitable Eclipse debug configuration. The debug configuration specifies the name of the executable file and how the contents of this file may be downloaded to the remote target and launched. To create a debug configuration, invoke the Debug dialog box using the Run->Open Debug Dialog... menu item. Select C/C++ Local Application, click on the New launch configuration icon to create the new configuration and then give it a meaningful name such as "ARM target on /dev/ttyS1". Then proceed with the following steps:

- On the Main tab, click on the Browse... button to select the project from which the executable file is created and then click on the Search Project... button to select the C/C++ application executable file to be debugged.

- On the Debugger tab, select gdb Remote Debugger as the debugger, enter the name of the GDB debugger (eg `arm-elf-gdb`) on the Main pane and then select the appropriate connection parameters from the Connection pane.

On Windows-hosted installations, it is also necessary to specify a path mapping for POSIX-style file paths before debugging. Invoke the Preferences dialog box using the Window->Preferences... menu item and select the C/C++->Debug->Common Source Lookup Path item from the tree of preferences. Click Add... and choose Path Mapping. A new path mapping entry will immediately appear in the Common Source Lookup Path tree. Click Edit... to modify this item, give the path mapping a meaningful name such as "Cygwin root" and then click Add... to specify the mapping paths. Enter a single forward slash character ("`/`") as the Compilation path and browse to the Local file system path directory corresponding to the POSIX-style root directory (typically `C:\cygwin`). This path mapping ensures that the POSIX-style source code references in eCos application executable files are interpreted correctly by CDT.

## Hardware debuggers

When using hardware debuggers such as those using a JTAG or BDM interface, it may be necessary to override the default behaviour of CDT for launching a debugging session. For example, an external tool may be required to install code into Flash memory prior to debugging. The eCosCentric plug-ins allow the user to perform such customisation by specifying a GDB command file on the Main pane of the Debug dialog box. The following optional GDB macros may be defined within the GDB command file:

- setup - this macro is invoked by CDT before connection to the target hardware is attempted. Within the macro, `$arg0` can be used to refer to the ELF executable file which is to be debugged and `$arg1` will provide the connection parameters.

- preload - this macro is invoked by CDT following connection to the target and before code download.

- doload - this macro is invoked by CDT to download code to the target hardware. The presence of this macro will suppress the default CDT code download behaviour.

- postload - this macro is invoked by CDT immediately following code download to the target hardware.

Prev | Home |
Creating eCos application projects |  |