Notice: We have migrated to GitLab launching 2024-05-01 see here:

Version 2 (modified by Ralph Holmes, on 01/05/16 at 20:17:10) (diff)

Fix broken link(s).


GDB Serial Monitors

The GNU debugger GDB allows you to debug your RTEMS application, BSP, and RTEMS itself. GDB can be found here:

GDB comes with a remote protocol. You can find detail about the protocol in the GDB documentation:

The remote protocol can be used over a serial port to a target or using TCP/IP. Here we look at a GDB serial monitor that lets you connect to your target.

Thread-Aware GDB Stubs

The RTEMS source tree includes thread aware GDB serial stubs for some of the supported CPU families. The shared portion of this code is located in [source:rtems/c/src/lib/libbsp/shared/gdbstub]. Code adapting the shared portion to particular CPU families is available for the following processors:

  • i386
  • lm32
  • m68k
  • MIPS

If you adapt this support to another processor family, please submit that work. If you are interested in working on TCP/IP based GDB stubs, there is a set of those available at SLAC.

Non-Thread Aware GDB Stubs

If an RTEMS thread-aware GDB stub is not available for your processor, GDB itself supplies a few working stubs for the following processors:

  • i386
  • m68k
  • sh
  • sparc

Check GDB for newer stubs. You may find others on the net, for example

Copy the GDB stub into your BSP and get it to compile. You need to write a putDebugChar and getDebugChar routine that interfaces to your target's serial port. You also need to provide a exceptionHandler routine and the m68k stub require you declare the exceptionHook variable. The GDB documentation provides the detail needed to achieve this.

The putDebugChar and getDebugChar require a polled serial type driver similar to one used by printk. The exceptionHandler routine interfaces to the processors vector table. Do not use the RTEMS interrupt catch API.

The above should provide you with a working GDB stub that is not thread aware. It is highly recommended that you put the effort into making the RTEMS thread-aware stubs support the CPU you are interested and submit it. in.