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

common than it used to be. Most monitor programs have some basic capabilities
                   in common:

                    The ability to examine and alter memory.
                    The ability to read and write 1/0 ports, if any.
                    The ability to set breakpoints in the code.
                    The ability to download code from a host PC.
                    The ability to interrupt code execution from the keyboard.
                    The ability to communicate via  an FS-232 serial port, Ethernet port, or other
                    interface.

                     The monitor program generally gets control on power-up. In the early days, the
                  user interface was a dumb terminal, but a dedicated PC is used universally today.
                  The user generally will download code into the target system RAM and execute it
                   there. The reason the code must run out of RAM is so that breakpoints can be set.
                  A breakpoint is a branch instruction (usually a one-byte or one-word instruction)
                   that replaces the instruction that normally would appear at a particular  location.
                  The branch returns control to the monitor program.
                     To use a monitor program, the user puts a breakpoint at some useful place in
                   the code, runs the program, and then examines memory and registers when the
                  breakpoint  occurs.  Breakpoints  can  be  placed  in  error  routines  to  determine
                  whether the error occurs.
                     As I mentioned earlier, some modern processors have hardware debug onchip.
                  In those parts, you can use a debugger that runs out of ROM or flash memory and
                  still have limited breakpoint capability.




                   Logic Analyzer Breakpoints


                  Since embedded systems are connected to the real world, you often need to know
                  what the  processor is  doing when  specific real-world events occur. This may  be
                  because the event represents an error condition or just because you need to know
                  how the software handles it (not how it is supposed to handle it, but how it really
                  does). Such events may occur when a sensor changes state, when a waveform passes
                  through a particular voltage, or when a rotating shaft reaches a particular position.
                  You may be able to capture the event on a logic analyzer or DSO, but how do you
                  take a “snapshot” of what the software is doing at that time? In many cases, you can
                  take advantage of the trigger output port of your logic analyzer or DSO. This tup
                  ically is a BNC connector with a logic level signal that goes high or low, or pulses,
                  when the analyzer or DSO triggers it.




                   180                                             Embedded Macrqtn-ocessm Systems
   194   195   196   197   198   199   200   201   202   203   204