What Happened to Object Software?

CrossGCC FAQ

Gnu CC manuals in HTML

Next Previous Contents

7. Using GDB for Remote Debugging

The gdb manual has information on how to do remote debugging with the targets that it supports. That is the best place to look. If you have `info' and the gdb `info' files installed you can run `info -f gdb.info -n Remote' to view the relevant section.

7.1 BDM Support

What is BDM, and why do I want it?

BDM stands for `Background Debug Mode', and it is a special debug interface on some of Motorola's embedded 68K and Power PC processors. BDM allows an external debug system to control and monitor the operation of theembedded processor through a 10-pin proprietary serial interface, without any software support in the target system and without the use of an In-Circuit Emulator (ICE). Using a low-cost interface cable to your PC's printer port, and the right software on your PC, you can perform most of your debugging directly on your target hardware at very low cost.

What processors have BDM capability?

Since BDM requires some special hardware on the embedded processor, you can't use it with just any old CPU. It is available only on a select set of Motorola's embedded microprocessors:

  • all MC68300 devices except the 68302, 68306, 68307, 68322, 68328, and 68356 (specifically, any device that is based upon Motorola's CPU32 processor core)
  • all Coldfire devices in the MCF52xx/MCF53xx series
  • all MPC500 and MPC800 embedded Power PC processors

What are the capabilities of BDM?

BDM (as implemented in the original CPU32 version) executes a small set of commands over a high-speed, proprietary serial interface that allows your debug host to read and write memory locations; read and write CPU registers; and start, stop, and reset the processor. Breakpoints are implemented by replacing a normal program instruction in your code with a special opcode that forces the processor into BDM.

The ColdFire processors implement the same command set, but have some extra hardware support in the form of a hardware breakpoint register.

The Power PC implementation of BDM is yet more capable. Instead of using a command language, it allows the debug system to feed CPU opcodes directly to the processor core to be executed. In addition, dedicated hardware implements a small number of hardware breakpoints for code execution, and watchpoints for data accesses.

What are the tradeoffs in using BDM for in-circuit debug?

BDM plays off the good old 80/20 relationship; it gives you 80% of the functionality of a full-blown ICE for 20% of the cost.Its major limitations are:

  • it cannot track execution in real time; you need a hardware logic analyzer to do this
  • for all intents and purposes, you must run your code in RAM in order to be able to set breakpoints. Some derivatives have limited hardware breakpoint capability, but not nearly enough for typical debugging situations.
  • On the 68k targets, it can only break on a fetch of a breakpoint instruction. The Power PC devices have some limited support for hardware data-fetch breakpoints.

Having said that, it should be noted that many developers regularly do the majority of their hardware and software debugging without using any other debug system, saving the expensive tools for those really difficult problems which cannot be tracked down without some real-time tools.

What else can BDM be used for?

Here are a couple of the most common applications:

  • Flash EPROM programming in-system
  • Production line testing and calibration

I am using a PC host system. How do I use BDM via gdb?

The first requirement is an interface cable. There are two options here:

  1. Motorola ( http://www.mot-sps.com) sells a software/hardware package manufactured by P&E Microsystems ( http://www.pemicro.com) under part number M68ICD32 which includes a cable and a simple assembly-language debugger; list price is $150. This cable is pretty much the standard for the 68k devices.
  2. The `Wiggler' from Macraigor Systems is an interface cable which supports both 68k and Power PC. List price is around $500 (last time I checked). Check our http://www.macraigor.comfor more info.

The other item is software support for the host system; a low-level driver is required to control these interface cables since the BDM protocol is not based on standard parallel or serial protocols.

683xx BDM resources

PowerPC (MPC5xx/MPC8xx) BDM resources

  • If you are running on a Win32 operating system (for example with the cygwin system from Cygnus), gdb has built-in support for the Macraigor device driver wigglers.dll, which is available for download as part of Macraigor's 'OCD Commander' package.

I'm using a Unix host system. How do I use BDM via gdb?

If you are on an Intel Linux system, there is a driver to implement BDM for 683xx targets; check out BDM via gdb on PC host. For other systems, several vendors have reasonably low-cost ICE-type products which interface via BDM and communicate with the host system via RS-232 serial ports, or Ethernet.

Where can I learn more about BDM?

BDM is fully documented in Motorola's reference manuals, document no. CPU32RM/AD for the 68k devices and MPC860UM/AD for Power PC. These documents may be ordered for free from Motorola's web site, http://design-net.com/home/lit_ord.html.


Next Previous Contents