p070 072 - 58 Windriver
p070 072 - 58 Windriver
your office or lab does not fully exercise system. Running dozens or hundreds of
by Jay Gould
Product Manager your embedded product the same way as “use cases” may seem powerful, but may
Xilinx, Inc. when it is fully assembled and deployed in create a false sense of security if you don’t
jay.gould@xilinx.com real-time conditions. Add other modules actually track metrics like code “coverage,”
from other engineers and your simple unit where you pay more attention to exercising
Steve Veneman tests may still pass for hours at a time. all of the code instead of repeatedly testing
Product Manager Often bugs will not reveal themselves until a smaller subset.
Wind River Systems you run the code for much longer periods Standard software debuggers are a useful
steven.veneman@windriver.com of time or with more complex interactions and much-needed tool in the embedded
with other code modules. development process, especially in the early
Have you ever worked on an embedded So how do you know if you are really stages of starting, stepping, and stopping
processing project where your team invest- testing all your code? Is it possible that a your way though brand-new code units.
ed an exorbitant amount of test time only colleague’s software may be overwriting a Once you have significant code applications
to find out at the end of the project that variable or memory address utilized in developed, testing the system as a whole
your product had a series of intermittent your module? becomes much more representative of an
and hard-to-find bugs? You used your soft- The more complex your embedded end-user product, with all of the interac-
ware debugger throughout the develop- products become, the more sophisticated tions of a real-time embedded system.
ment process and spent man-weeks your development and debugging tools However, even a good software debugger
stepping through the code in your lab, yet must scale. Often “test time” is equated may not improve your chances of finding
when your software passed integration test- with “good testing” practices: the longer an intermittent, seldom-occurring bug.
ing you were stunned to find that your QA you run tests, the better you must be exer- Serious code interaction – made more com-
team (or worse yet, a customer) discovered cising the code. But this is often mislead- plex with asynchronous interrupts of real-
serious system flaws. ing for a number of reasons. Stubbing world embedded devices – mandates the
Some embedded bugs are harder to find code and testing a module in a stand- use of proper tools to observe the entire sys-
than others and require advanced detection alone method will miss many of the inter- tem, creating a more robust validation envi-
methods. Testing small units of code in action mistakes of the rest of the final ronment in which to find the sneakier bugs.
70 Xcell Journal Copyright © 2006 Xilinx, Inc. All rights reserved. XILINX, the Xilinx logo, and other designated brands included herein are trademarks of Xilinx, Inc. All other trademarks are the property of their respective owners. Third Quarter 2006
Trace Your Code Execution lems are not easily found by post-mortem information is next accessed.
Once your code goes awry, locks up your debugging through register and memory With advanced tools like Wind River
system, core dumps, or does something accesses. Embedded systems commonly Trace, you can capture the actual instruc-
seriously unexpected, it is time to improve crash when a function is overwriting a vari- tion and data information that was execut-
the visibility of exactly what your software able that should not be accessed/written, or ed on the target before the event occurred.
was doing before the flaw. Often the symp- when memory is corrupted by executable Using this information, you can back up
tom of the failure is not clearly tied to the code being overwritten by another routine. through the executed code and identify
cause at all. Some debuggers or target tools It is difficult to diagnose these types of what events happened before the crash,
running on the embedded device will die problems when no information exists on identifying the root cause of the problem
with a fatal system flaw, so they cannot be what actions led up to an event, and the (see Figure 2). In addition to a chronologi-
used to track that flaw. In these cases, you crash of the system may not actually take cally accurate instruction sequence, when
can use a separate and external tool with its place until much later when the corrupted used on a PowerPC™ embedded platform
own connections and hardware memory to like Xilinx® Virtex™-II Pro or Virtex-4
provide an excellent view of system execu- devices, the Wind River Trace execution
tion all the way up to a complete failure. information also includes specific time-
“Trace” tools, often associated with JTAG stamp metrics. Coincidentally, the Wind
probes or ICEs (in-circuit emulators), can River ICE actually implements Xilinx
display an abundance of useful informa- Virtex-II Pro FPGA devices in the probe
tion for looking at software instructions hardware itself.
executed, lines of code executed, and even
performance profiling. Coverage Analysis and Performance Profiling
Capturing software execution with a Because the trace tool and probe are able to
trace probe allows more debugging capabil- provide a history of the software execution,
ity than just examining a section of code. they can tell you exactly where you have
An intelligent trace tool provides a wide been – and what code you have missed.
variety of trace and event filters, as well as Figure 1 – The Wind River ICE JTAG You miss 100% of the bugs that you don’t
trigger and capture conditions. One of the probe implements Virtex FPGAs. look for, so collecting coverage analysis
most useful situations for trace techniques
is to identify defects that cause target crash-
es on a random, unpredictable basis.
Connecting a probe (Figure 1) like
Wind River ICE with the integrated
Wind River Trace tool introduces a
method by which you can configure trace
to run until the target crashes. By trigger-
ing on “no trigger,” the trace will contin-
ue to capture in a circular buffer of
memory in the probe until the system
crashes. You may have unsuccessfully tried
to manually find a randomly occurring
defect with your software debugger, but
with a smart trace tool, you can now run
the full battery of system tests and walk
away to let the trace run. When that inter-
mittent event finally occurs again, crash-
ing the target, the tool will capture and
upload the data for your examination.
The execution trace will show a deep
history of software instructions executed
on your system leading up to the fatal flaw,
providing much more insight into what the
system was doing and allowing you to find Figure 2 – Wind River Trace software execution view
and fix the bug faster. Often these prob-