Adding Diagnostic Helps to the Target System

This chapter answers how to make debugging easier. The trace buffer is a powerful technique for most embedded designs, if there is enough memory to support it. Typically, when something goes wrong in an embedded system, one wants to know what happened just prior to the failure. The trace buffer already described will be a binary length, and each location will hold 1 byte. Each byte is an action code that indicates some specific action. PC can mask the patterns individually, and if a pattern is masked, the monitor will detect it but not send the notification to the PC. One might want to put more information in our trace buffer to track down this hypothetical problem. One could add commands that provide finer detail. While timetagging data using a free-running counter, remember that a rollover may be more than one rollover. That is, the count may have rolled over, gone to FFFF, and rolled over again. In most debugging scenarios, one will care only that the difference is big, not how big it is. If one really needs to know the exact time, there are some ways around this problem. One is to use a counter with more bits, enough that it will never roll over between two events.