Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Debug RCE applications with xmd

...

XMD (Xilinx Microprocessor Debugger) is a low-level (assembly language) debugger that is provided by Xilinx as part of a product called EDK (Embedded Development Kit). It communicates with the FPGA powerPC over a JTAG interface. The secret of a large portion of this magic is that it is able to inject instructions into the processor over JTAG (interestingly, these instructions can be recorded to text files and disassembled with some work).

The main features of XMD that we have been using are:

  • read/write memory (both off-chip and integrated on-chip FPGA Block RAM)
  • read/write powerPC cache/tags
  • read/write powerPC registers
  • read/write registers on the FPGA DCR bus
  • download/control powerPC elf executables, including setting breakpoints/watchpoints.

An example XMD session:

Code Block

[cpo@rdcds204]$ xmd
(some output deleted)
XMD% rst -processor
Target reset successfully

XMD% dow pgpforward
System Reset .... DONE
Downloading Program -- pgpforward
        section, .vectors: 0x00000100-0x00002003
        section, .text: 0x00002020-0x00079c73
        section, .data: 0x00079c78-0x0007cc13
        section, .gcc_except_table: 0x0007cc14-0x0007dd8f
        section, .got: 0x0007dd90-0x0007e7c3
        section, .jcr: 0x0007e7c4-0x0007e7c7
        section, .bss: 0x0007e7d0-0x000986eb
Setting PC with Program Start Address 0x00002020

XMD% con
Info:Processor started. Type "stop" to stop processor

RUNNING> XMD%

When connecting to the powerPC, XMD must be told which memory ranges to map onto memory/DCR/cache. We have been doing this with an "xmd.ini" file which is executed by XMD on startup:

Code Block

connect ppc hw -debugdevice isocmstartadr 0xFFFFF000 isocmsize 4096 isocmdcrstartadr 0x0000000 icachestartadr 0x10000000 itagstartadr 0x20000000 dcachestartadr 0x30000000 dtagstartadr 0x40000000 dcrstartadr 0x50000000

One can also use gdb to connect to XMD over the network, as a full source-code debugger. An example session:

Code Block

[cpo@rdcds204]$ powerpc-rtems-gdb -nw pgpforward
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-redhat-linux-gnu --target=powerpc-rtems4.7"...
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
download_entry ()
    at ../../../../../../../../RTEMS/c/src/lib/libbsp/powerpc/rce405/dlentry/dlentry.S:14
14      ../../../../../../../../RTEMS/c/src/lib/libbsp/powerpc/rce405/dlentry/dlentry.S: No such file or directory.
        in ../../../../../../../../RTEMS/c/src/lib/libbsp/powerpc/rce405/dlentry/dlentry.S
warning: no shared library support for this OS / ABI
Current language:  auto; currently asm
(gdb) break init_executive
Breakpoint 1 at 0x24f0
(gdb) c
Continuing.
Can't send signals to this remote system.  SIGUSR2 not sent.

Breakpoint 1, 0x000024f0 in init_executive ()

Debug RCE applications with the console

...