| |||
Home > Configuring RealView ICE for GDB > Methods of connecting from remote GDB sessions > Connections to a target with a GDB stub (Target-GDB) |
These are connections to a target that is running an application with a GDB stub, and are referred to as Target-GDB connections. The GDB stub enables the target application to communicate with a host application through RealView ICE, using the DCC of an ARM architecture-based processor. The DCC carries the GDB protocol packets between the target and the remote GDB session over the TCP/IP ports 5000, 5001,... as shown in Figure 8.2. See also RealView ICE TCP/IP ports used.
Use the Target-GDB connection method to:
debug a target system that does not have an OS
debug a target system with an OS that supports GDB.
To use the Target-GDB connection method, it is recommended that you compile the DCC driver and GDB stub into your target application using a GNU toolchain for ARM architectures (see The GNU toolchain for ARM architectures). You can either:
link the example GDB stub into your target application or operating system
port your existing serial GDB stub to use the DCC driver.
On the GDB connection to the target, it is recommended that you enable DCC and Virtual Ethernet/TTY mode before starting the processor (see Setting DCC parameters).
If your application includes a target-resident GDB stub, it can communicate over DCC.
To debug an application using a Target-GDB connection:
Power up your target hardware and RealView ICE unit.
Configure the core using rvconfig, using either
automatic or manual configuration. Save the rvc
file
in a convenient location.
Run rvigdbconfig, specifying the rvc
file
that was created in step 2, and the appropriate DCC mode, for example
mode 2: rvigdbconfig –f rvi.rvc -d 2:2
Start GDB, load the symbols if required, and connect to the second core (for example) to load and run your application in the usual way. This example uses port 4001 of RealView ICE:
arm-elf-gdb(gdb) file demo.elf (gdb) target remote rvi5:4001 Remote debugging using rvi5:4001 0x00000000 in $a () (gdb) (gdb) load demo.elf Loading section .vectors, size 0x30 lma 0x0 Loading section .text, size 0x1dbcc lma 0x8000 Loading section .rodata, size 0x1bcb4 lma 0x25bcc Loading section .data, size 0xc84 lma 0x41980 Start address 0x8000, load size 238900 Transfer rate: 106177 bits/sec, 318 bytes/write. (gdb) (gdb) c Continuing.
Start another GDB session to debug the image in the usual way, using (in this example) port 5001, the first available port of RealView ICE:
(gdb) set remotetimeout 10 (gdb) filemyprogram
(gdb) target remotervi5
:5001
You only have to perform steps 1 to 3 once at the start. You can perform steps 4 and 5 as often as required.
For information on allocating ports, see Port numbering.