Page 157 - The Art of Designing Embedded Systems
P. 157
144 THE ART OF DESIGNING EMBEDDED SYSTEMS
part up. Most implementations, therefore, rely on software rather than
hardware breakpoints. That is, the source debugger that drives the BDM/
JTAG port sets a breakpoint by replacing the first byte or word of the in-
struction’s opcode with a special instruction that places the chip in debug
mode. This is much like ROM monitors that use an illegal opcode or sim-
ilar instruction to invoke a breakpoint handler.
Most of the interfaces, though, also have a hardware breakpoint input
pin. Drive this line high and the CPU halts execution of the firmware.
Some vendors offer quite elaborate bus monitors (for those target systems
that indeed have a viewable bus) that support complex break conditions
(“break when routine ’ timer-isr ’ called after variable foobar writ-
ten”). This is where ICE meets BDM, as quite a bit of ICE-like hardware
is required.
So, the upside of a BDM or JTAG debugger boils down to this:
A debugger on-board the chip eliminates all speed issues. It func-
tions despite cache’s complications. Even when the CPU is hidden
in a huge ASIC, if just a few pins come out for the serial debugger,
then designers will have some ability to troubleshoot their code.
JTAGBDM lets you set simple breakpoints, single-step, and ex-
amine and change memory and VO . . . in short, everything you
can do with a normal PC design environment, such as Microsoft’s
Visual C++.
BDM-like solutions are a reasonable subset of a debugging
methodology. They’re so inexpensive that every developer can
have the toolset. Some tool vendors properly promote these as
nothing more than debugging adjuncts, devices designed for work-
ing on certain non-real-time sections of code. Their message is to
“use the right tool for the right job-a BDM where it makes sense,
and a full-function emulator for real-time troubleshooting.”
Given that run control offers basic system access, breakpoints, and
the like, what do we lose when we chose one of these over an ICE?
Emulation RAM does not exist on BDMs. No serial debugger now
extant or proposed offers any sort of memory that replaces your
system ROM. To download code, you can relink so the code exe-
cutes from your system RAM area, assuming there’s plenty of free
RAM space, or replace your ROM chips with RAM, which depend-
ing on your system design may or may not be possible. Another
option is to mix tools, using a ROM emulator; download code to the
emulator and test it via the BDWJTAG port.

