Home > User Support > CoverageMaster winAMS FAQ

CoverageMaster winAMS FAQ

MPU Simulator

000_01: The simulator stops with an error. How can I output a simulation log to investigate the cause?

Question:

The simulator stops with an error message while performing a unit test. How can I output a simulation log to investigate the cause of the error?

Answer:

A simulation log file can be output showing each instruction that was executed until the error occurs. Thus the simulation log can be useful for identifying where in the code an error occurs.

[How to output the simulation log]

The source code that will be used as an example is as follows.

The source code itself does not include an error, but the following command is entered into the startup command file in order to cause an error for the sake of this example.

patch 0xfffe05e4="12345678"

The above command overwrites part of the execution code to cause an error.

GAIO's simulator comes in 2 types, "SYSTEM-G" and "SX". The simulation log differs depending on which simulator type is used.

SYSTEM-G Simulator

1. From the SSTManager "Target Settings" screen, uncheck "Start Automatically" and "Do not output the Start and End messages for each function".

2. Click the "Start Simulator" button to start the System Simulator.

3. From the System Simulator "Tool" menu, select "Options".

4. Set the Trace settings as indicated in the image below and click "Apply".


5. From the System Simulator "Execution" menu, select "Go" to run the test until the error occurs.
Note: Additional time is required to run the simulation with the trace settings enabled.

6. The simulation log file is generated in the test project folder with filename "systemg.log".

Note: After generating the simulation log file it is recommended to disable the trace setting to improve simulation speed.

[SYSTEM-G log file sample]

;Log File:    C:\test\cm1_sem\systemg.log
;Start Log:    Thu  21-Feb-2019 14:09:31
;
;
;%SYSTEMG-I-PROCESS, process "winAMS" is started
;traced to resetprg\PowerON_Reset_PC\#79    <- resetprg.c line #79 executed
;traced to resetprg\PowerON_Reset_PC\#92
;traced to resetprg\PowerON_Reset_PC\#95
;traced to resetprg\PowerON_Reset_PC\#104, returned from MEM::fffe08ac
;traced to resetprg\PowerON_Reset_PC\#108
;traced to resetprg\PowerON_Reset_PC\#111
;traced to main\main\#18, called from resetprg\PowerON_Reset_PC\#111    <- main() called
;%SYSTEMG-I-STOPPROGRAM, Program execution stopped by process "winAMS"
;%SYSTEMG-I-XIPC, function "main\func1" called by process "winAMS"    <- func1() called
;traced to main\func1\#41
;traced to main\func1\#43
;traced to main\func1\#49
;SEM-E:[SXG-HTB-000201] Undefined Instruction executed.(pc=FFFE05E5H)    <- error occurs
;%SYSTEMG-E-SEM, invalid operation code found
;  `MEM::fffe05e5'
;%SYSTEMG-I-PROCESS, process "winAMS" was exited with [0]    <- abnormal termination
;%SYSTEMG-I-PROCESS, process "winAMS" is terminated
;
;End   Log:    Thu  21-Feb-2019 14:09:49
;

From the simulation log we can see that an undefined instruction was executed at program count (pc) FFFE05E5H. This is the address overwritten using the patch command above. From the log file we also learn that the error occurs after executing line #49 of main.c while within func1().

SX Simulator

When using the "SX" simulator, you cannot select the simulator trace option from the GUI (due to the difference in simulator architecture). Instead, set the trace settings in the startup command file.

1. From the SSTManager "Target Settings" screen, uncheck "Do not output the Start and End messages for each function".

2. Add the following line to the startup command file.

set trace/line

3. Click the "Start Simulator" button and run the simulation.

Note: Additional time is required to run the simulation with the trace settings enabled.

4. The simulation log file is generated in the test project folder with filename "sx.log".

Note: After generating the simulation log file it is recommended to disable the trace setting to improve simulation speed.

[SX log file sample]

;Log File:    C:\test\cm1_sx\sx.log
;Start Log:    Thu  21-Feb-2019 14:12:28
;
;
;%XTP-I, Start Sub Process (WinAMS.dll)
;traced to resetprg\PowerON_Reset_PC\#79    <- resetprg.c line #79 executed
;traced to resetprg\PowerON_Reset_PC\#92
;traced to resetprg\PowerON_Reset_PC\#95
;traced to resetprg\PowerON_Reset_PC\#104
;traced to resetprg\PowerON_Reset_PC\#108
;traced to resetprg\PowerON_Reset_PC\#111
;traced to main\main\#18
;%SX-I-XIPC, function "main\func1" is called by process "WinAMS"    <- func1() called
;traced to main\func1\#41
;traced to main\func1\#43
;traced to main\func1\#49
;%XTPC-E, SX-E:[HSN-HTC-000101] Undefined Instruction executed. (pc=0xfffe05e5)    <- error occurs
;%SX-E-TARGET, user error in target process "hsnhtcl" [error code 4098 (1002h)]
;break at main\func1\#49+10
;%SX-I-PROCESS, process "hsnhtcl" was exited with [0]    <- abnormal termination
;%SX-I-PROCESS, process "hsnhtcl" is terminated
;
;End   Log:    Thu  21-Feb-2019 14:12:47
;

From the simulation log we can see that an undefined instruction was executed at program count (pc) 0xfffe05e5. This is the address overwritten using the patch command above. From the log file we also learn that the error occurs after executing line #49 of main.c while within func1().


Related Technical Tips Search

Other technical tips in GAIO's web site can be searched for using the links below.

Search key word link: Simulation Error
Technical Tips Google Search


Information Links