Debugging LEON3

2012-03-01Publicerad av Sven-Åke Andersson


GRMON is a general debug monitor for the LEON processor, and for SOC designs based on the GRLIB IP library. GRMON includes the following functions:

  • Read/write access to all system registers and memory
  • Built-in disassembler and trace buffer management
  • Downloading and execution of LEON applications
  • Breakpoint and watchpoint management
  • Remote connection to GNU debugger (GDB)
  • Support for USB, JTAG, RS232, PCI, Ethernet and SpaceWire debug links

The GRMON debug monitor is intended to debug system-on-chip (SOC) designs based on the LEON processor. The monitor connects to a dedicated debug interface on the target hardware, through which it can perform read and write cycles on the on-chip bus (AHB). The debug interface can be of various types: the LEON2 processor supports debugging over a serial UART and 32-bit PCI, while LEON3 also supports JTAG, ethernet and spacewire (using the GRESB ethernet to spacewire bridge) debug interfaces. On the target system, all debug interfaces are realized as AHB masters with the debug protocol implemented in hardware. There is thus no software support necessary to debug a LEON system, and a target system does in fact not even need to have a processor present. Here is a picture showing how the debug support is implemented. For more information about GRMON see the user's manual.


GRMON installation

See chapter Writing our first application program for information on how to install and start GRMON.

Debugging session

We will debug the LEON3 SOC using the JTAG cable connection. Let's start GRMON and load the program PrimeNumbers.exe.


Getting help

The help command shows all the debug commands:


Setting a breakpoint and single step.



GDB interface

GRMON can act as a remote target for GDB, allowing symbolic debugging of target applications. To initiate GDB communications, start the monitor with the -gdb switch or use the GRMON gdb command:

grmon-eval -xilusb -u -gdb

Then, start GDB in a different window and connect to GRMON using the extended-remote protocol. By default, GRMON listens on port 2222 for the GDB connection.
We use the command: target extended-remote localhost:2222 when debugging from the same machine. If we are connecting from another host replace localhost with the name of the target machine.