24
4.8.1. Loading a Program
To load a program, use the File menu commands “Download” and “Load Module.” In the
ensuing Download dialog box, select the proj_1.695 file.
A program will be loaded, with part of the program at the position of the program counter
displayed. The position of the program counter is marked by a yellow line.
4.8.2. Executing up to the main Function
First, run the program up to the main function.
To display the main function, select the View and the Source button and then select tutor3.c
and main. Then click the OK button and select the SRC button.
You will notice that dashes “-” are shown in the BRK column of the Program Window. They
indicate the positions at which you can set a breakpoint. Try double-clicking the dash “-” in
the line 00056 of the Line column. The dash “-” will change to the letter “B,” indicating that
a breakpoint has been set there.
While in this state, click the Go button. The program will be executed up to this position,
with the line 00056 turned into yellow.
4.8.3. Confirming Interrupt Generation
We’ll now confirm interrupt generation.
The brk_interrupt function is not called from any function. It can only be called by executing
the BRK instruction.
Execution of the BRK instruction is handled by the break_instruction function in the
execute_brk function. This break_instruction function is an inline function that is replaced by
the BRK instruction. The execute_brk function is called when the variable my_char is set to
‘i.’
The value of the variable my_char may be watched in the global window of the debugger.
From the BasicWindow menu, choose C Watch Window and then Global Window.
Set a breakpoint in the line 00037 of the Line column and click the Go button several times.
Then, when the variable my_char is set to ‘i,’ the line 00037 will have its color changed to
yellow. This allows you to confirm that an interrupt has been generated.
To quit the debugger, choose Exit from the File menu of the M3T-PD38SIM.
Comentarios a estos manuales