Motorola once sc140 User Manual

Page of 28
Introduction
1
1
Introduction
A stopwatch timer is an apparatus for measuring the exact duration of an event. Measuring time during 
execution of code on a Digital Signal Processor (DSP) is useful to identify opportunities for code 
optimization, to understand system loading, and to compare execution speeds of different processors.
This application note presents techniques to implement a stopwatch timer on the StarCore, SC140, using 
the built-in features of the DSP’s Enhanced On-Chip Emulation (OnCE) module.
Although many devices with embedded DSPs provide application-specific timer blocks, these timers 
cannot be used for debugging purposes without interference from the application itself. The ability to use 
the Enhanced OnCE as a stopwatch timer allows for non-intrusive timing capabilities and is available on 
any system that integrates the SC140 core.
Two techniques to set up the stopwatch timer are described in this application note: 
1. Setting up the stopwatch timer using the SC140 code within an application.
2. Setting up the stopwatch timer using the Metrowerks Code Warrior debugger
1
The examples given in this application note describe the use of the stopwatch timer in the StarCore, 
SC140’s Software Development Platform (SDP). Minor configuration changes are needed to apply the 
techniques to other SC140-based devices. The necessary modifications are also described in this 
application note. 
This document is organized to present these techniques as follows: Section 2, “SC140 Enhanced OnCE 
Stopwatch Timer Capabilities,”  d
escribes the specific capabilities of the stopwatch timer for the SC140 
Enhanced OnCE. Section 3, “Setting Up the Stopwatch Timer Within an Application,”  describes 
instrumenting the SC140 application code to use the stopwatch timer. Section 4, “Setting Up the 
Stopwatch Timer Within the Debugger,”  
presents the set up of the stopwatch timer within the Metrowerks 
Code Warrior debugger.
Supporting information is included in the remainder of the document. Section 5, “Setting Up the System 
Clock Speed,”  
describes how to set the clock rate of the SC140 in the SDP by configuring the PLL in 
hardware and software applications. Section 6, “Verifying Correct Setup,” describes techniques to verify 
that the system is set up correctly and that the measurements are reasonable. The Section 7, “Conclusion,” 
provides a summary of this document. Section 8, “References,” lists additional documentation to help the 
reader and Appendix A, “Complete Example of Profiling,”  provides a complete profile using the 
Enhanced OnCE stopwatch timer in the SC140.
1. At the time this application note was written, the release of Metrowerks Code Warrior is Beta v.1.0. All the figures related to screen capture
of Code Warrior tools may vary in future versions.