Page 196 - Embedded Microprocessor Systems Real World Design
P. 196
bits are used for the data. For example, you might use address 8000 for trace
opcodes and COO0 for data. Of course, this only works if the ROM is external.
Getting Data Off the Board
There are several methods to get the action codes out of the hardware. Write-to-
ROM and read-from-ROM could be picked up with a DIP (Dual Inline Package)
clip or PLCC (Plastic Leaded Chip Carrier) extender. Since DIP packaging is all
but obsolete, action codes on a surface mount design will be difficult to connect
to if the hardware wasn’t designed for it from the beginning. One way to bring
the action codes off the board is to add a simple pin header. On one design, I
added a row of pads to the board and connected to them with spring-loaded “pogo”
pins.
Software Timing
Although many emulators can perform this function, action codes can be used for
software timing. The software returns a trace value at the entry and exit of each
major subroutine, function call, or whatever level of code is to be analyzed. Using
a logic analyzer with time-tagging capability, the trace values are captured, and you
can determine how long the code spends in each routine. I used this technique
when working with a software engineer on a problem where the software would just
“go away” for a while. It did not lock up; it just took too long and other things quit
working because of the delay. We added trace points to the software and discovered
that the problem occurred in a function that parsed data received from another
system. When the error occurred, we clearly saw action codes generated from enter-
ing the routine and the exit from that routine occurring much too late.
Of course, this technique also can be used to determine how much time the
software is spending in each routine or how long it spends servicing each interrupt.
The disadvantage of this technique is that you must change the code any time
you want to capture something different. An emulator with time-tagging and
source-level debug capability will let you capture different timing information with
ease.
Software Throughput
Sometimes it is necessary just to have an idea of how busy the processor is while it
is running to know if there is a problem with throughput. One technique is to set
Adding Debug Hardware and Software 177