Hardware Reference
In-Depth Information
Figure 3.37 The CodeWarrior debugger screen after downloading program onto the memory
After executing the first three instructions, the debugger window is changed as shown in
Figure 3.38.
Use the Run to Cursor command to find out the program execution result. For example, we
can move the mouse cursor on the bne addloop instruction and press the right mouse button. This
will bring up a popup window (shown in Figure 3.39) that displays all the debug commands that
the user can apply. Select the Run to Cursor command by clicking on it. After this, the value of
sum is changed to 11 whereas the value of icnt is changed to 19. Both are correct. Now move the
mouse cursor to the next instruction (ldd sum) and then press the right mouse button and select
the Run to Cursor command. This time, the value of sum is changed to 410 whereas the value of
icnt is changed to 0. Both are also correct. Now move the mouse cursor to the bra $ instruction
and then execute the Run to Cursor command again. This time, the value of the variable average
is changed to 20 which is the quotient of 410 divided by 20 (the fraction is truncated because the
CPU is performing integer divide). This is also correct. We have verified that the program is correct
(shown in Figure 3.40).
O THER C OMMONLY U SED D EBUGGER C OMMANDS
Set Program Counter
Sometimes the user may need to execute an instruction sequence starting from a certain
instruction. This command allows the user to do just that. The user can set the program
counter to the address of any instruction by taking the following actions:
1. Place the mouse cursor at the instruction at which the program counter is to be set in
the Source window.
2. Press the right mouse button to bring up the debugger command menu.
3. Select the Set Program Counter command.
 
Search WWH ::




Custom Search