Symbolic, Source-level Debugging with RTEMS- on Virtex-4

Chris Johns chrisj at
Fri Dec 22 22:02:31 UTC 2006

Robert S. Grimes wrote:
> Okay, I've got the tools built and installed, Virtex-4 patches applied,
> RTEMS built and installed, and the hello_world_c built. Now what do I do?
> Specifically, how do I get a debugger up and running? The Xilinx
> Platform Studio (XPS) provides an Insight/GDB debugger, and it provides
> the "Xilinx Microprocessor Debugger", or XMD. Here's what I have found.
>    1. The Xilinx-documented approach is to start XMD from within XPS.
>       According to Xilinx, "now XMD is connected to PowerPC and has
>       started the GNU debugger (GDB) server port 1234 for source level
>       debugging using the GDB console."
>    2. Again from within XPS, start the GDB (powerpc-eabi-gdb) Console.
> At this point, you can connect GDB to XMD’s GDB server TCP port 1234 and
> debug programs locally (hostname=localhost) or remotely (hostname = IP
> addr).
> This all works fine for programs built with the Xilinx-provided GCC
> tools. However, when I try to debug the RTEMS hello_world_c demo
> program, I run into a number of issues:
>    1. First, the output directory contains several files; I'm not sure
>       what they are, but I believe the hello.srec is just the Motorola S
>       records, and the hello.exe is actually an .elf file. Is that right?

It usually is but it could be stripped or further processed for a boot 
loader. It depends on the BSP set up.

You should have a .elf file. This has the debug information and the one 
to use.

>    2. The XMD shell can download and execute the hello.exe file ("dow
>       hello.exe", then "run"), but this is not particularly useful.
>       We're talking about a simple monitor here.
>    3. The Insight/GDB can load and execute the .srec file, but obviously
>       knows nothing about symbols.
>    4. Attempting to load the hello.exe in Insight/GDB causes a stackdump
>       (attached, though probably not useful)..

This could be for a range of reasons. If you built RTEMS with the MinGW 
tools the path in the elf file could up set Insight but this is just a 

> Oh, the GDB included with the Xilinx tools is GDB 5.3, while the RTEMS
> version I have installed is 6.4. I'm guessing I'll need to deal with
> another version of Insight?

It may pay to try a later version. I would start with gdb then consider 
Insight after that.

> Has somebody gotten this working? Can anyone point me in the correct
> direction? I'm certainly happy to document this all on the Wiki in
> exchange for any help...

Not with the specific gdb server you are using or the PowerPC target or 
Insight otherwise yes. :-)

I have QEMU working for the i386 target with a MinGW GDB on Windows. 
QEMU contains a GDB server also on port 1234. I did the following with 
the MSYS shell:

  $ tar zxf gdb-6.5.tar.gz
  $ cd gdb-6.5
  $ patch -p? < ../gdb-6.5-rtems-20060713.diff
  $ cd ..
  $ mkdir i386-rtems4.7
  $ cd i386-rtems4.7
  $ ../gdb-6.5/configure --target=i386-rtems4.7 --verbose \
        --disable-nls --without-included-gettext \
        --disable-win32-registry --disable-werror --enable-sim \
  $ make
  $ make install


a) The -p? option to patch needs to be a number, ie -p5 to match the 
patch you use. I cannot see in the MSYS shell history what I used.
b) The simulator is built. This may cause a problem for your target so I 
suggest you do not add this option.

This will give you a command line MinGW version of GDB which should 
handle the ELF files GCC generates. I hope it talks to your gdb stub 
without any problems.

  (gdb) target remote :1234

is all I need to connect to the QEMU GDB server.

I do not use Insight, rather I use a Win32 build of Emacs and run the 
MinGW gdb inside Emacs. This gives me a source level interface.

FYI I had started the work to add GDB to the installers but hit a little 
problem with GDB and the simulators:

It is on my list of list things to do.


More information about the users mailing list