1 initializing the stopwatch timer, Initializing the stopwatch timer – Motorola ONCE SC140 User Manual

Page 12

Advertising
background image

8

Using the SC140 Enhanced OnCE Stopwatch Timer

3.6

Adapting Stopwatch Timer Code to Other SC140

Devices

The stopwatch timer implementation controls the Enhanced OnCE by writing to its memory-mapped
registers. The addresses of these registers are determined in the memory map of the device in which the
SC140 core is embedded. The offset between the base address of the memory-mapped peripherals and the
addresses of the Enhanced OnCE registers is the same across SC140-based devices.

Therefore, when adapting the stopwatch timer code for a specific device it suffices to set the value of
REG_BASE_ADDRESS in the header file “EOnCE_registers.h.” In the Software Development Platform
(SDP), the base register of Enhanced OnCE is 0x00effe00. Consult the user manual of the specific device
for the value to set this C macro.

4

Setting Up the Stopwatch Timer Within the
Debugger

The preceeding section described a technique that requires instrumenting, or modifying, the source code of
the application being measured. Occasionally developers are faced with a situation where instrumentation
of the code is not possible. For example, the code might be available in object form only.

In such cases it is possible to measure execution times by setting up the stopwatch timer within the
Metrowerks Code Warrior SC140 debugger. This section explains this set up.

4.1

Initializing the Stopwatch Timer

The technique described in Section 3 triggered the stopwatch timer by detecting a write to the stopwatch
timer flag variable. When the stopwatch timer is set up within the debugger, the triggering event is chosen
to be the execution of the first instruction in the measured code. Program code disassembly is used to
obtain the address of this first instruction.

NOTE:

In the following descriptions of selecting options in the debugger
windows, the > character separates each command in the menu hierarchy.
For example, EOnCE > EOnCE Configurator > EDCA1 lists the
hierarchy to be followed to select the EDCA1. In this example, one would
highlight EOnCE in menu bar, then highlight EOnCE Configurator, and
finally, choose the EDCA1 tab.

4.1.1

Setting Up the Event Detector

The procedure to set up the stopwatch timer is described in this section. To set up the event detector, find
the starting address of the measured function or sequence of instructions, as follows:

1. Choose Project > Debug.

2. In the debugger window, choose “mixed”.

The starting address can be found in mixed mode, as shown in Figure 4 on page -9.

Advertising