Specifications
Embedded System Tools Guide (EDK 6.2i) www.xilinx.com 33
UG111 (v1.4) January 30, 2004 1-800-255-7778
Some Useful Tools
R
Debugging Using Hardware: software intrusive
Create your application executable using the compiler. For example
mb-gcc -g -xl-mode-xmdstub file1.c file2.c
This command creates the Microprocessor executable a.out, linked with the C runtime 
library crt1.o and starting at physical address 0x400, and with debugging information that 
can be read by mb-gdb (or powerpc-eabi-gdb if compilation was done for PowerPC).
If you want to debug your code using a board, you must specify the DEFAULT_INIT 
parameter for that processor to XMDSTUB in MSS file. This creates a Data2MEM script 
(run_download) file that initializes the Local Memory (LM) with the xmdstub executable. 
Next, load the bitstream representing your design onto your FPGA. Refer to Chapter 13, 
“Xilinx Microprocessor Debugger (XMD),” and Chapter 7, “Library Generator,” for more 
information.
Start the xmd server in a new window with the following command:
xmd
Connect to use stub target GDB. Please see Chapter 13, “Xilinx Microprocessor Debugger 
(XMD),” for more information.
Load the program in mb-gdb using the command:
mb-gdb a.out
Click on the “Run” icon and in the mb-gdb Target Selection dialog, choose 
- Target: Remote/TCP
- Hostname: localhost
- Port: 1234
Now, mb-gdb’s Insight GUI can be used to debug the program.
Debugging Using A Simulator: non-intrusive
If you want to debug your code using a simulator, compile programs using the following 
command:
mb-gcc -g file1.c file2.c
This command creates the MicroBlaze executable file, a.out, with debugging 
information that can be accessed by mb-gdb. For PowerPC, the compiler used is 
powerpc-eabi-gcc.
Xilinx EDK provides two ways to debug programs in simulation.
1. Cycle-accurate simulator in XMD:
Start xmd server in a new window with the following command:
xmd
Connect using sim target. Please see the XMD documentation for more information.
Loading and debugging the program in mb-gdb is done the same way as for xmd in 
hardware mode described above.
This is the preferred mechanism to debug user programs in simulation
2. Simple ISA simulator in mb-gdb:










