Page 190 - Embedded Microprocessor Systems Real World Design
P. 190
Adding Debug Hardware 6
and Software
In designing the hardware and software for an embedded microprocessor system,
we typically give most of our attention to the actual application. However, all embed-
ded systems must be debugged eventually. The addition of selected hardware and
software can simplify the debug process.
Almost any embedded system can benefit from the strategic addition of hard-
ware and software for debugging. Depending on cost and size constraints, the hard-
ware may not be installed but instead connected to the circuit only when data
collection actually is required. However, the software must support the functional-
ity regardless of whether the hardware is installed or not.
This chapter focuses on adding debug capability that allows operation of the soft-
ware to be traced to provide a history of what has happened when something goes
wrong. Developers who cannot use an emulator, for whatever reason, will see the
obvious utility of the techniques to be presented in this chapter. Users who have
access to sophisticated emulators may question why additional debug tools should
be incorporated into the design. There are several reasons:
Operation in “Live” Environment. The equipment may have a subtle bug that
shows up only in a customer’s environment where an emulator cannot be
connected or where use of the emulator would stop critical work. Some types
of equipment cannot be stopped while the software engineer looks through
the emulator traces to find what caused a problem. In cases like this, when an
error occurs, the data are captured and the machine must be restored to
operating condition immediately. The data must be examined later. Similarly,
it may be impractical to stop a processor that is controlling a robotic arm or
other motordriven device where physical damage can occur if the processor
stops but the object it is controlling doesn’t.
Macro History. Built-in debug tools give a macro history of system operation.
Embedded real-time systems often control mechanical devices, which can have
a significant lag between an error and the event that caused the error. An
emulator can give very detailed information around the error itself, but its
171