Real-time systems can be difficult to debug, as experienced programmers know only too well. The intermittent bugs that often are discovered in the field and reported by customers are among the most troublesome. They’re difficult to monitor because they frequently cause system crashes, wiping memory clean and corrupting data, so they can’t be traced in the lab.
That’s why developers need a “black-box flight recorder,” built to survive a crash with all the data stored for turning the clock back to an earlier system state. Advanced JTAG-based emulation peripherals now make black boxes possible, allowing developers to observe the state of the system at any point during program execution. Using these tools, developers find it much easier to debug intermittent problems, leading to faster development and greater product lifetime reliability.
Traditional debugging tools are becoming less effective as systems become more complex. The most important action takes place in specialized engines and internal memories, untraceable by the fastest logic analyzers, limiting visibility into the core. Accessibility is limited when a probe cannot fit into a small form factor, even if a suitable in-circuit emulator (ICE) is available. Integrated debug functionality works well for prototypes, but many real-time problems have to be observed in production devices.
JTAG emulation capabilities can provide more thorough real-time analysis of core operations. The core under test doesn’t have to perform additional debugging functions. Instead, the peripherals operate in parallel to it, typically with full access to system registers and memory and even executive control over the entire processor. This non-intrusive visibility enables the most highly optimized portions of code to be monitored.
New emulation tools support the reconstruction of events leading up to a crash through real-time data exchange (RTDX) and self-tracing, with assistance from complex triggering, multiprocessor support, time-critical interrupt masking, and various utilities. These techniques help create a black box that accurately reconstructs the state of the device at any point in time and in great detail.
RTDX and self-tracing peripherals and utilities can be used in combination to maintain a “flight record” of system processes. The processor filters, compresses, or evaluates data to send the required information across the limited-bandwidth test bus. One example of a self-tracing peripheral, the discontinuity trace, only tracks the value of the instruction pointer when it is modified by, say, a branch rather than for every instruction. The number of loop iterations can be counted, permitting a deeper view of the execution path and enabling the developer to focus on other kinds of trace information. It also quickly reveals where the program starts executing outside the code.
Other debug peripherals support black-box functionality as well. When several processors or multiple accelerators are integrated on-chip, a debug peripheral identifies the code for each processor and permits the monitoring of shared resource buses. Global breakpoints keep multiprocessor communications in sync, preventing unnecessary restarts to resync. For interrupts that require service even when the processor is halted, processors now support time-critical interrupt masking. This allows the system to continue handling such real-time, real-world factors even when the processor isn’t executing.
Advanced debug peripherals allow designs to be put in a black-box recorder. Complete trace and modification functionality makes it possible to create a trace buffer that lets developers observe the state of a system at any point and reconstruct previous states accurately. With sufficient off-chip bus bandwidth, large buffers can store the trace buffer externally, creating a real black box that enables developers to find intermittent bugs by simply connecting to the trace storage tool. Such capabilities are indispensable for real-time systems because they save vast amounts of debugging time, providing faster time-to-market and improved reliability over the product’s lifetime.
Dan Rinkes is an emulation applications engineer for Texas instruments, working with key customers in designing and leveraging advanced emulation technology. He holds a BS in electrical engineering from the University of Pittsburgh, Pittsburgh, Pa. He can be reached at: [email protected].