No renderer 'pdf' found for mode 'pdf'
world leader in high performance signal processing
Trace: » gdbproxy

Gdbproxy

When debugging under the gdb environment, the debugger needs to know what target to connect to. This target is a tiny server daemon, typically running on the host computer. It is equivalent to a gdbserver, although it does not run on the target hardware. This server is called gdbproxy and is derived from rproxy-0.7.

Here we use the IGLOO as example. IGLOO is connected to host via parallel cable. See the list of JTAG devices for other devices that are known to work.

On the host, we run gdb and gdbproxy. Gdbproxy talks to the JTAG device, sitting between gdb and the target. gdb talks with gdbproxy locally via TCP.

Gdb is used the same way as debugging via Ethernet or serial through gdbserver. So the instructions below only describe how to get and install gdbproxy.

Install

The toolchain release includes binaries in the package called blackfin-jtag-tools. See the installing page for more info

You might also want to review the non root usb setup so you don't need to run these tools as the super user all the time.

Testing

This is the procedure you normally start with:

  1. Connect IGLOO with your host and target
  2. Power on the board
  3. Start up gdbproxy as: bfin-gdbproxy bfin [other special options],e.g, here we debug a BF537-STAMP board
    $ bfin-gdbproxy bfin
    
    Remote proxy for GDB, v0.7.2, Copyright (C) 1999 Quality Quorum Inc.
    MSP430 adaption Copyright (C) 2002 Chris Liechti and Steve Underwood
    Blackfin adaption Copyright (C) 2008 Analog Devices, Inc.
    
    GDBproxy comes with ABSOLUTELY NO WARRANTY; for details
    use `--warranty' option. This is Open Source software. You are
    welcome to redistribute it under certain conditions. Use the
    '--copying' option for details.
    
    Initializing ADI IGLOO JTAG Cable on parallel port at 0x378
    IR length: 5
    Chain length: 1
    Device Id: 00100010011111001000000011001011
      Manufacturer: Analog Devices
      Part:         BF537
      Stepping:     2
      Filename:     /home/adam/workspace/jtag/share/jtag/analog/bf537/bf537
    warning:   bfin: no board selected, BF537 is detected
    notice:    gdbproxy: waiting on TCP port 2000
    
    You can try adding the -q (quiet) and --reset (reset the processor every time it connects) if you like.
  4. Start bfin-uclinux-gdb or bfin-elf-gdb
  5. Connect to the gdbproxy via:
     (gdb) target remote :2000 

    Gdbproxy will output message:

    notice:    gdbproxy: connected 

The Blackfin will now halt and you can:

  • Set software breakpoints with 'b'
  • Set hardware breakpoints with 'hb'
  • Source line single step with 's' or 'n'
  • Instruction single step with 'ni' or 'si'
  • Disassemble using 'disassemble $pc $pc+20' or 'x/10i $pc'
  • Print core register values 'print $r0' or 'info registers' etc.
  • Continue program operation with 'c'
  • Stop program with Ctrl-C

Debugging kernel

Debug booted kernel

  1. Compile kernel with debug info and frame pointer
  2. Download linux image to the board and boot it
  3. Start gdbproxy (here we use IGLOO)
    $ bfin-gdbproxy bfin
    Remote proxy for GDB, v0.7.2, Copyright (C) 1999 Quality Quorum Inc.
    MSP430 adaption Copyright (C) 2002 Chris Liechti and Steve Underwood
    Blackfin adaption Copyright (C) 2008 Analog Devices, Inc.
    
    GDBproxy comes with ABSOLUTELY NO WARRANTY; for details
    use `--warranty' option. This is Open Source software. You are
    welcome to redistribute it under certain conditions. Use the
    '--copying' option for details.
    
    Initializing Macraigor Wiggler JTAG Cable on parallel port at 0x378
    IR length: 5
    Chain length: 1
    Device Id: 227c80cb
    Active: 0
    notice:    gdbproxy: waiting on TCP port 2000

    Make sure you saw message similar to this, otherwise the gdbproxy may not work. Check your JTAG connection, parallel cable, also the USB power supply to the IGLOO.

  4. Connect gdb to gdbproxy
    $ bfin-elf-gdb vmlinux
    (gdb) target remote :2000
  5. Now the kernel should be stopped in idle loop.
  6. Set software breakpoint
    (gdb) b cpuinfo_open
    (gdb) c
  7. When you do cat /proc/cpuinfo on the target board, it should stopped at cpuinfo_open ().

Debugging the kernel boot process from the first instruction at 0x1000

  1. Run u-boot and tftp the kernel image
  2. Set a hardware breakpoint at 0x1000, the address of the first instruction the kernel executes when it boots
    (gdb) hb *0x1000
  3. Boot the kernel
    stamp> boote
  4. Just after u-boot jumps to the first instruction of kernel, the kernel will stop, gdb will print out that the kernel has stopped at 0x1000

Debug standalone application

To load an ELF binary into memory and execute

(gdb) load blink.dxe
Loading section .text, size 0x1b8 lma 0xffa00000
Start address 0xffa00000, load size 440
Transfer rate: 3520 bits in <1 sec, 440 bytes/write.
(gdb) c
Continuing.

More commands: see GDB help

Note that the above examples assume, that the peripheral hardware has been properly initialized. GDB does not initialize anything on start, since it has no knowledge about the current state of the system. Before you load a program into the Blackfin, make sure you have done the correct initialization - read more hints below.

For different system configurations, GDB scripts are used. GDB scripting is a very powerful feature and helps to automatize different system configurations.

JTAG debuugers cannot be used on coLinux since coLinux cannot access parallel port.

Dual Core (BF561) Debugging

Starting from 2008R1 release, gdbproxy supports dual core debugging of BF561.

To Be Added.

Trouble shooting

"error: bfin: detecting parts failed"

There may be several cases lead to this error”

bfin-gdbproxy bfin

Remote proxy for GDB, v0.7.2, Copyright (C) 1999 Quality Quorum Inc.
MSP430 adaption Copyright (C) 2002 Chris Liechti and Steve Underwood
Blackfin adaption Copyright (C) 2008 Analog Devices, Inc.

GDBproxy comes with ABSOLUTELY NO WARRANTY; for details
use `--warranty' option. This is Open Source software. You are
welcome to redistribute it under certain conditions. Use the
'--copying' option for details.

Initializing ADI IGLOO JTAG Cable on parallel port at 0x378
error:     bfin: detecting parts failed
Segmentation fault
ICE or target not powered on

If you got message like this, please check whether your ICE or target board is powered on. IGLOO uses a USB cable for power supply, sometimes the USB port you used may not supply enough power.

IGLOO: are you using a crossover cable

If you are using a crossover ethernet cable to connect IGLOO and target board, you will get this error message.

Double fault

In case your system got a double fault and gdbproxy report an error like ” a double fault has occured EMUPC [0xFFA00A1E]”, please restart gdbproxy. Otherwise, it would be in a unstable state.