8.2.3. 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.

Figure 8.2. Target-GDB connections


Target-GDB Scenarios

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.

Target-GDB Requirements

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.

Note

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

Procedure for debugging applications through Target-GDB connections

If your application includes a target-resident GDB stub, it can communicate over DCC.

To debug an application using a Target-GDB connection:

  1. Power up your target hardware and RealView ICE unit.

  2. Configure the core using rvconfig, using either automatic or manual configuration. Save the rvc file in a convenient location.

  3. 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

  4. 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.
    
  5. 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) file myprogram
    (gdb) target remote rvi5:5001
    

    See How connections to multiple processors are allocated.

Note

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.

Copyright © 2002, 2004-2008 ARM Limited. All rights reserved.ARM DUI 0155J
Non-Confidential