GDB Server

Plugins ››
Parent Previous Next

Introduction

winIDEA is distributed together with a plug-in that implements GDB server functionality. This plug-in can be used to connect GDB and other tools that use the GDB Remote Serial Protocol (RSP) to winIDEA. This document describes its capabilities, explains how to configure winIDEA to use it, provides an example of its usage and a reference of custom monitor commands.

Description

The winIDEA GDB server is a winIDEA software plug-in, a DLL hosted inside winIDEA, that listens on a TCP port for incoming GDB RSP connections. This plug-in serves requests coming from GDB or other programs that implement the RSP.

To initialize the emulator and connect to the target winIDEA has to be properly configured. A working winIDEA project that includes emulator settings, target initialization and image download settings has to be set-up, prior to using GDB and the winIDEA GDB server.

GDB reference

Information about gdb is available on the internet.

The main gdb page is:

http://www.gnu.org/software/gdb/

The gdb documentation page is available here:

http://www.gnu.org/software/gdb/documentation/

The gdb user manual is here:

http://sourceware.org/gdb/current/onlinedocs/gdb.html

Alternatively you can access it here:

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gdb/index.html

Plug-in management and configuration

The winIDEA GDB server is loaded by default. To verify that the winIDEA GDB server is installed and available:

*Inside winIDEA open the “Plugins” menu, and select “Options…”


*This will open the “Plugin options” dialog


*Here make sure “GDB server” is listed in the “Built-in” plug-in list.


The winIDEA GDB server has a status window that can be optionally shown.

*Open the “Plugins” menu. In the “GDB server” sub menu you can see if the status window is displayed and toggle its display status from here.


*The “GDB server – Status” window shows the status of the winIDEA GDB server (running or stopped), the listening port, the architecture assumed and if the plug-in is started when it is loaded. The toolbar has buttons to start and stop the winIDEA GDB server and a button to access the configuration dialog.


The configuration dialog gives access to the configurable parameters of the winIDEA GDB server.

*You can check the port where the plug-in is listening. By default the plug-in listens on the TCP port 5544. You can change the port in this dialog.

*The configuration dialog is also used to set the architecture that will be used by the winIDEA GDB server.

*The “Auto start” check box in the “Configuration” dialog enables and disables the automatically start of the winIDEA GDB server on load.

Example

The following example is based on iSYSTEM’s ITMP5554 evaluation board and the example for this board distributed with winIDEA. You can follow the same procedure for other projects and boards.

*Start winIDEA

*Load your project


*Download your program to the target


*Open a command line prompt

*Start GDB, passing the program image file name as the only parameter. Optionally you can start GDB and load the image later.

*At the GDB prompt type “show architecture”. Make sure that the program image architecture matches the architecture configured at the winIDEA GDB server plug-in. See the Configuration section of this document for more information on how to set the architecture.

*At the GDB prompt type “target remote :5544” to connect GDB to the winIDEA GDB server plug-in. GDB will display the point where the processor is stopped.

*After winIDEA, the GDB server plug-in and GDB are started you can type commands at the GDB prompt to use the winIDEA GDB server functionality.


Custom monitor commands

Downloading a binary file to the target

To download a binary file to the target use the following command:

(gdb) monitor download <file name>

Where “file name” is the full path to the file to be downloaded.  For example:

(gdb) monitor download c:\MyProject\output.elf

Setting the GDB server architecture

To set the architecture that will be used by the GDB server, type the command:

(gdb) monitor architecture <arch_name>

Where “arch_name” is the name of the architecture you want the GDB server to assume. For example:

(gdb) monitor architecture powerpc:common

Supported architectures are:

*68K

*ARM

*HC12

*powerpc:common (aliases: powerpc, ppc, ppc:common)

*powerpc:e500 (aliases: e500, ppc:e500)

*v850

Reseting the target

To reset the target use the reset command. For example:

(gdb) monitor reset

Accessing Special Function Registers (SFR)

To read an SFR you should type the following at the GDB prompt:

(gdb) monitor sfr.read <register name>

Where register name is the name of an SFR as shown in the winIDEA SFR window, for example: PID0, UARTCFG, DBCNT, MSR, L1CFG0, etc

To write an SFR use this command:

(gdb) monitor sfr.write <register name> <register value>

The register value could be specified as decimal (for example 1234), octal (0 prefix, for example 0765) or hexadecimal (0x prefix, for example 0xf00d)

For example:

(gdb) monitor sfr.write L1CSR0 0x12345678