Electronic Products - June 2007 - 33
EMBEDDED DEVELOPMENT TOOLS Simulation aids fast embedded MCU design The latest class of simulators support some unique features BY DARREL JOHANSEN Microchip Technology Chandler, AZ http://www.microchip.com T here are many ways to debug an embedded application. A debug tool, comprising in-circuit emulators (ICEs) and in-circuit debuggers (ICDs), enables the designer to prototype a system quickly, and helps identify hardware and software problems—both in the prototype and final-test stages. During the debug process, where cost and ease of use are major issues, designers may prefer to use a simulator instead of an ICE to debug code fragments—because it can be done on a PC without the need for target hardware. Simulators can be very handy because developers can use them to learn about a new MCU or familiarize themselves with a new integrated development environment (IDE) tool suite without the target hardware. In some cases, they can review all of a vendor’s MCUs for free. For example, both the MPLAB IDE and MPLAB SIM simulator (see Fig. 1) from Microchip can be downloaded free from the vendor’s Web site. Fig. 1. Many simulators, such as Microchip’s MPLAB SIM, provide a graphical user interface to aid fast application debug. . Simulator offers extra debug features Generally, a simulator runs under an IDE and has similar features to other debug engines. You can start by developing code using the simulator and, when your hardware is ready, you can use a hardware debugger to do testing The basic debug functions that can be performed by the simulator include: executing the code to verify it functions to specifications; resetting the target to restart the application; halting the program at breakpoints; and examining and modifying memory and variables. You can do more with the latest class of simulators, which support some unique features not available with hardware debuggers. For example, you can easily break execution on complex situations—a feature that is not supported by all ICEs and ICDs. Complex events can even be constructed to count occurrences and execute a breakpoint. This kind of complex breakpoint allows you to describe the condition where your code misbehaves, and traces code at that condition. This is usually a much faster way of finding bugs than setting simple breakpoints and stepping through your code. ic the peripherals found on an MCU. To facilitate this, advanced simulators feature a complex stimulus generator that simulates signals. Using this feature you can test a firmware module by providing inputs to it in ways that are difficult to produce using the real hardware—for example, creating two interrupts 50 ns apart. The stimulus generator can send signals to pins or to registers in the sim- Analyze code through simulation Designers can use a simulator to react to pin inputs and outputs, as well as mimFig. 2. Simulators often support three types of stimulus sources and feature easy definition and setup. http://electronicproducts.com JUNE 2007 ELECTRONIC PRODUCTS 33
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.