Page 191 - Embedded Microprocessor Systems Real World Design
P. 191

trace buffer often is not deep enough to allow operation around the cause of
                      the error to be examined. One real-world example of this is a document
                      processor that I worked on. This machine moved checks and other paper at a
                      rate of over 1600 documents per minute. An 8031-based subsystem (described
                      earlier in Chapter 4) was having problems controlling document spacing. The
                      error could not be detected until about 150 milliseconds (ms) after the event
                      that caused the error. On an 8031, 150ms is about 150,000 instructions, and
                      the emulator just could not store that much data. Fortunately, I did not need
                      to see every instruction to determine what was wrong. Using a technique
                      similar to the ones described in this chapter, I was able to capture just the
                      pertinent information on a logic analyzer and locate the actual problem.
                      Limited Resources. Some systems have limited resources, such as those found
                      in single-chip microcontroller systems. If you have only 2K of program space
                      to work with, it may be difficult to fit a full debugger into the chip along with
                      the application code. Simple debug tools let you see what is going on inside
                      the code when you lack the room for a full development environment.
                      Emulator Won’t Work.  Occasionally, you run across a problem that won’t show
                      up with the emulator connected. This is usually a symptom of a hardware
                      problem, but not always.
                      Lack of Physical Connection. You may need to add debug tools because you
                      cannot physically connect an emulator to your system. If your processor uses a
                      BGA  (Ball Grid Array) or other surface-mount package, it may be impossible
                      to connect an emulator. You  can debug your system on a board with a socket
                      adapter or other means to connect the emulator, but once you go to
                      production, you have no way to make the emulator connection.
                      Correlation. Sometimes you need to correlate software execution with
                      outside events such as a motor position, sensor output, or analog input
                     voltage.



                       ~    ~~
                   Action Codes


                   The key to adding debug tools to an embedded system is determining what to save.
                   In general, I like to keep track of the following as a minimum:
                     Each entry to an interrupt routine.
                     Each exit from an interrupt routine.
                     Each time a major function is performed (such as execution of a command from
                     a higher-level controller).
                     Each time a message or command is passed to the outside world.

                   172                                             Embedded Micropomsar Systenzs
   186   187   188   189   190   191   192   193   194   195   196