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 debug hardware, 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 the following figure:

Figure 54. Target-GDB connections

To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.

Show/hideTarget-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.


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


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 debug hardware unit.

  2. Configure the processor 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 processor (for example) to load and run your application in the usual way. This example uses port 4001 of debug hardware:

    arm-elf-gdb(gdb) file demo.elf
    (gdb) target remote rvi5:4001
    Remote debugging using rvi5:4001
    0x00000000 in $a ()
    (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) c
  5. Start another GDB session to debug the image in the usual way, using (in this example) port 5001, the first available port of debug hardware:

    (gdb) set remotetimeout 10
    (gdb) file myprogram
    (gdb) target remote rvi5: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.

Show/hideSee also

Copyright © 2010-2011 ARM. All rights reserved.ARM DUI 0498D