To execute the above macro, enter “macro” in the command line (located on the bottom of the ICD status window). Browse to the location where your macro is saved and open the file. Please note that any built-in commands can also be executed individually. This gives the user the opportunity to perform a step-by-step test of the macro prior to starting the automated debugging procedure.
P&E offers a set of In-Circuit Debuggers that are packed with powerful scripting features. Whether you are stepping through a couple of lines of assembly code or debugging a C-level source, P&E's toolset can help you get the job done. P&E's In-Circuit Debuggers are designed with repeatable test and debugging procedures in mind. Therefore, the user can completely automate software tests by creating a macro script and saving the outcome in a log file. As a result, the user can avoid hours of repeatedly setting up software and firmware tests.
Here's a small demonstration of how the built in macro commands can be used to create and perform a repeatable firmware test on a 9S08AW60 processor. We'll be working with a simple assembly loop that's designed to toggle Port A every 20 CPU cycles. Please note that while the example below will be based on ICDHCS08 debugger, the same set of macro commands is present in all P&E debuggers. For a complete set of built-in macro features, please refer to the ICD COMMANDS section in the corresponding ICDxx.hlp file.
Source under test:
RAMSTART equ $70
Org RAMSTART
Main:
mov #$ff,$01 ; ptadd
mov #$ff,$00 ; ptad
lda #$ff
Loop:
mov #$00,$00 ; 4 cycles
nop
nop
nop
nop
nop
nop
mov #$ff,$00 ; 4 cycles
nop
nop
jmp loop ; 4 cycles
The macro outlined below will load our loop_example.s19 and .map files. At the same time it will set the program counter, set the breakpoints, and initialize variables. As the code executes, it will also capture the contents of the desired registers as well as the contents of all on-screen windows. All information will in turn be stored in a log file for later comparison and analysis:LF test_output.log ; creates log file HLOAD loop_example.s19 ; load an .s19 with a map file PC Main ; set program counter to point to the beginning of the ; code VAR $00 ; add a variable to a variable window VAR $01 ; add a variable to a variable window GOTIL Loop ; run through initialization part of the code to the loop DUMP $00 $01 ; dump the contents of registers $00 to $01 into the log ; file BR Loop ; set a breakpoint at the beginning of the loop GO ; run the code until it hits a breakpoint SNAPSHOT ; captures the current data in all open windows and stores ; them in a log file. LF ; close log file