Specifications

Embedded System Tools Guide (EDK 6.2i) www.xilinx.com 183
UG111 (v1.4) January 30, 2004 1-800-255-7778
PowerPC Targets
R
Note: The simulators provide a non-intrusive method of debugging a program. Debugging using the
hardware target is intrusive because it needs an xmdstub to be running on the board.
Note: If the program has any I/O functions like print() or putnum(), that write output onto the UART
or JTAG Uart, it will be printed on the console/terminal where the xmd server was started. (Refer to
the MicroBlaze Libraries documentation for libraries and I/O functions information).
Compiling for Debugging on MicroBlaze targets
In order to debug a program, you need to generate debugging information when you
compile it. This debugging information is stored in the object file; it describes the data type
of each variable or function and the correspondence between source line numbers and
addresses in the executable code. The mb-gcc compiler for Xilinx’s MicroBlaze soft
processor includes this information when the appropriate modifier is specified.
The -g option in mb-gcc allows you to perform debugging at the source level. mb-gcc
adds appropriate information to the executable file, which helps in debugging the code.
mb-gdb provides debugging at source, assembly and mixed (both source and assembly)
together.
While initially verifying the functional correctness of a C program, it is also
advisable to not use any mb-gcc optimization option like -O2 or -O3 as mb-gcc does
aggressive code motion optimizations which may make debugging difficult to follow.
For
debugging with xmd in hardware mode, the mb-gcc option -xl-mode-xmdstub must be
specified. Refer to the XMD documentation for more information about compiling for
specific targets.
PowerPC Targets
GUI mode
Hardware debugging for the PowerPC405 on Virtex-II Pro is supported by powerpc-eabi-
gdb and xmd through the GDB Remote TCP protocol. To connect to a hardware PowerPC
target, first start xmd and connect to the board using the ppcconnect command as
described in the XMD chapter. Next, select
Run o Connect to target from GDB and in the
GDB target selection dialog, choose:
x Target: Remote/TCP
x Hostname: localhost
x Port: 1234
Click OK and powerpc-eabi-gdb attempts to make a connection to XMD. If successful, a
message is printed in the shell window where XMD was started.
Console mode
To start powerpc-eabi-gdb in the console mode type :
xilinx > powerpc-eabi-gdb -nw executable.elf
In the console mode, type the following two commands to connect to the board through
xmd.
(gdb) target remote localhost:1234
(gdb) load
For the consolse mode, these two commands can also be placed in the GDB startup file
gdb.ini in the current working directory.