This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM48L952: We want to "AUTOMATE" Complete Process to generate CODE COVERAGE REPORT , using Spectrum Digital XDS PRO Trace functionality

Part Number: RM48L952
Other Parts Discussed in Thread: CCSTUDIO,

Hi ,

Using Code Composer Studio we are able to download the Project binaries and set the Spectrum Digital XDS PRO Trace and collect the Code coverage Report for TUV Certification . 

We wan to achive using DSS scripting same steps

We want to "AUTOMATE" - CODE COVERAGE REPORT , using XDS PRO Trace functionality

For Automation I used scripting from DSS and generated Binaries . 

For Downloading the Binaries There are set of Batch scripts that I can run .

Finally there are 3 steps that needs to be Automated . 

STEP 1 : Goto TOOLS -> Hardware Trace Analyzer and select Code Coverage . 

STEP 2:  CLICK OK on the Initialize Hardware Trace Analyzer

STEP 3: Change Parameters like Number of Pins to 8 in Code Coverage Configuration 

Step 4: Finally I get the Code Coverage  , the CCS IDE Starts logging . I also need the path where the logs are stored / Updated . 

I have to automate this process , Can someone suggest XDS PRO Code Coverage report generation using Scripting 

  • Hello,

    This was once possible using DSS DVT scripting as demonstrated in chapter 5 of the Trace Analyzer User's Guide. However, DSS DVT scripting has been deprecated in recent CCS versions and is no longer supported:

    https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/670211/ccs-rm48l952-dss-analysis-error-dvtserver-not-working

    They may be a way to do this using ctools trace. I will need to investigate further if this is possible.

    Thanks

    ki

  • I will try to see what is possible with ctools trace. It will take a bit of time to set up the pro trace environment. apologies for the delay. I will keep you posted of any updates.

    ki

  • Just a quick (non) update: I will have access to my pro trace receiver tomorrow and will try things out then

  • Step 1)  I installed CCS v6.2.0 and executed the .js scripts. 

    Step 2) I updated following 4 lines  Is this update correct ? can I change the menu names as shown in Images in question above

    analysisConfig.setProperty("Cores", dsC66_0.getName());
    analysisConfig.setProperty("Transport Type", "Pro Trace");
    analysisConfig.setProperty("Buffer Size", "512 kB");
    analysisConfig.setProperty("Number of Pins", "8 Pin");

    Step 3) Following line at 66 fails to execute in the scripts  . The script would halt and throw error .

    analyzer.waitForEndOfData();

    importPackage(Packages.com.ti.debug.engine.scripting)
    importPackage(Packages.com.ti.ccstudio.scripting.environment)
    importPackage(Packages.com.ti.dvt.engine.scripting)
    importPackage(Packages.java.lang)
    importPackage(Packages.java.io)
    importPackage(Packages.java.util)

    /*
    * This file contains an example for running Code Coverage Analysis on a C6670 board over XDSPRO
    * It enables the Merge option for Code Coverage and merge data from 2 runs.
    *
    * The example will export processed data to CSV files locate in CWD (Current Working Directory).
    *
    * See /ccs_base/scripting/docs/DVTAnalyzerScripting.htm for complete details on
    * Hardware Trace Analyzer scripting
    */

    // ---------- Start up ----------
    script = ScriptingEnvironment.instance();
    script.setScriptTimeout(240000);

    // Create a log file in the current directory to log script execution
    script.traceBegin("scriptLog.xml", "../../DefaultStylesheet.xsl");
    script.traceSetConsoleLevel(TraceLevel.INFO);
    script.traceSetFileLevel(TraceLevel.INFO);

    script.traceWrite("Starting Code Coverage");

    // ---------- Set up debugger ----------
    script.traceWrite("Launching debugger");
    debugServer = script.getServer("DebugServer.1");
    debugServer.setConfig("c:/Users/Kalvacherla/Documents/200800_sgpcu_Sprint_CK/04 - Software/04 - SW SRC/RM48/PSP/Platforms/Native/Hercules/projects/SIL2PSP_Extension_RM48L952/RM48L952.ccxml");
    dsC66_0 = debugServer.openSession("Spectrum Digital XDSPRO USB Emulator_0/CortexR4");

    script.traceWrite("Connecting CPU");
    dsC66_0.target.connect();

    script.traceWrite("Loading program");


    // ---------- Create a DVT server ----------
    dvtServer = script.getServer("DVTServer.1");

    // ---------- Set up the analysis ----------
    script.traceWrite("Setting up Code Coverage Analysis with merging");
    analysisSession = dvtServer.openAnalysisSession();

    analysisConfig = analysisSession.loadAnalysis("Hardware Trace Analyzer/Code Coverage");
    analysisConfig.setProperty("Cores", dsC66_0.getName());
    analysisConfig.setProperty("Transport Type", "Pro Trace");
    analysisConfig.setProperty("Buffer Size", "512 kB");
    analysisConfig.setProperty("Number of Pins", "8 Pin");


    analysisConfig.run();

    //---------- Run target for 2 secs ----------
    script.traceWrite("Running target");
    dsC66_0.target.runAsynch();
    Thread.sleep(2000);
    dsC66_0.target.halt();

    // ---------- Wait until processing is done ----------
    script.traceWrite("Processing");
    analyzer = analysisConfig.findAnalyzerByName("Code Coverage");
    analyzer.waitForEndOfData();

    //---------- Post analysis - export the result from first run to a CSV file ----------
    cwd = script.getCurrentDirectory();
    script.traceWrite("Exporting results to " + cwd);
    analyzer.exportDataToCSV("Line Coverage", cwd+"/"+"LineCoverageLive.csv", null);
    analyzer.exportDataToCSV("Function Coverage", cwd+"/"+"FunctionCoverageLive.csv", null);

    //---------- Again run target for 2 secs ----------
    script.traceWrite("Running target again");
    dsC66_0.target.restart();
    dsC66_0.target.runAsynch();
    Thread.sleep(2000);
    dsC66_0.target.halt();

    // ---------- Wait until processing is done ----------
    script.traceWrite("Processing (merging with existing code coverage statistics)");
    analyzer.waitForEndOfData();

    // ---------- Post analysis - export merged result to a CSV file ----------
    cwd = script.getCurrentDirectory();
    script.traceWrite("Exporting results to " + cwd);
    analyzer.exportDataToCSV("Line Coverage", cwd+"/"+"LineCoverageLive_Merged.csv", null);
    analyzer.exportDataToCSV("Function Coverage", cwd+"/"+"FunctionCoverageLive_Merged.csv", null);

    // ---------- shut down ----------
    script.traceWrite("Shutting down");
    analysisSession.endAnalysis(analysisConfig);
    debugServer.stop();
    dvtServer.stop();
    script.traceEnd();

  • Hello,

    I was able to run DVT scripting to generate coverage data. Like you, I modified one of the example scripts so that it would run for a Hercules RM57L evm using XDS PROTRACE. 

    Attached is my example script and generated csv:

    FunctionCoverageLive.csv

    importPackage(Packages.com.ti.debug.engine.scripting)
    importPackage(Packages.com.ti.ccstudio.scripting.environment)
    importPackage(Packages.com.ti.dvt.engine.scripting)
    importPackage(Packages.java.lang)
    importPackage(Packages.java.io)
    importPackage(Packages.java.util)
    
    /*
     * This file contains an example for running Code Coverage Analysis on a C6670 board over XDSPRO
     * The example will export processed data to CSV files locate in CWD (Current Working Directory).
     *
     * See /ccs_base/scripting/docs/DVTAnalyzerScripting.htm for complete details on 
     * Hardware Trace Analyzer scripting 
     */
    
    // ---------- Start up ----------
    script = ScriptingEnvironment.instance();
    script.setScriptTimeout(240000);
    
    // Create a log file in the current directory to log script execution
    script.traceBegin("scriptLog.xml", "DefaultStylesheet.xsl");
    script.traceSetConsoleLevel(TraceLevel.INFO);
    script.traceSetFileLevel(TraceLevel.INFO);
    
    script.traceWrite("Starting Code Coverage");
    
    // ---------- Set up debugger ----------
    script.traceWrite("Launching debugger");
    debugServer = script.getServer("DebugServer.1");
    debugServer.setConfig("C:/ti/ccs6.2.0.00050/ccsv6/ccs_base/scripting/examples/DVTExamples/HardwareTraceAnalyzer/liveExamples/rm57/rm57l843_protrace2.ccxml");
    dsR5 = debugServer.openSession("*", "*"); 
    
    script.traceWrite("Connecting CPU");
    dsR5.target.connect();
    
    script.traceWrite("Loading program");
    dsR5.memory.loadProgram("C:/ti/ccs6.2.0.00050/ccsv6/ccs_base/scripting/examples/DVTExamples/HardwareTraceAnalyzer/liveExamples/rm57/RM57Lx_demo_software.out");
    
    // ---------- Create a DVT server ----------
    dvtServer = script.getServer("DVTServer.1");
    
    // ---------- Set up the analysis ----------
    script.traceWrite("Setting up analysis session");
    analysisSession = dvtServer.openAnalysisSession();
    
    analysisConfig = analysisSession.loadAnalysis("Hardware Trace Analyzer/Code Coverage");
    analysisConfig.setProperty("core", dsR5.getName());
    analysisConfig.setProperty("transportType", "Pro Trace");
    analysisConfig.setProperty("bufferSize", "64 kB");
    
    analysisConfig.run();
    
    //---------- Run target for 2 secs ----------
    script.traceWrite("Running target");
    //dsR5.target.runAsynch();
    //Thread.sleep(2000);
    //dsR5.target.halt();
    dsR5.target.run();
    
    // ---------- Wait until processing is done  ----------
    script.traceWrite("Processing");
    analyzer = analysisConfig.findAnalyzerByName("Code Coverage");
    analyzer.waitForEndOfData();
    
    
    // ---------- Post analysis - export the data to a CSV file ----------
    cwd = script.getCurrentDirectory();
    script.traceWrite("Exporting results to " + cwd);
    analyzer.exportDataToCSV("Line Coverage", cwd+"/"+"LineCoverageLive.csv", null);
    analyzer.exportDataToCSV("Function Coverage", cwd+"/"+"FunctionCoverageLive.csv", null);
    
    // ---------- shut down ----------
    script.traceWrite("Shutting down");
    analysisSession.endAnalysis(analysisConfig);
    debugServer.stop();
    dvtServer.stop();
    script.traceEnd();
    

    The error in your screenshot is because in the line before is returning "null"

    analyzer = analysisConfig.findAnalyzerByName("Code Coverage");
    Hence analyzer is null and hence the error on line 66.
    When i run my example, you can see analyzer is not null:
    I'm not sure why the call failed for you. Please check to see if the trace pod is configured correctly. Please see my script for an example.
    Thanks
    ki
  • The Command Prompt Output on exit looks as shown below is there any specific Command prompt settings like run in Admin Mode etc ? .

    Should we setup any environment variables ? Run the command prompt in Admin mode ? what is the WINDOWS OS etc ? .

    Should we execute the scripts on WINDOWS 7 ? any requirement of WINDOWS updates ? . I am executing this script on WINDOWS 10 .

    Attached my SYSTEM configuration , can I get the System configuration of your PC .

    The JAVA SCRIPT CONSOLE is as follows 

    Starting Code Coverage
    Launching debugger
    Connecting CPU
    CortexR4: GEL Output: Memory Map Setup for Flash @ Address 0x0
    Loading program
    dvtLogOptions.xml DOES NOT exists
    ENTRY (com.ti.dvt.engine.scripting.DVTServer.start Thu Nov 25 14:50:26 CET 2021)
    RETURN (com.ti.dvt.engine.scripting.DVTServer.start Thu Nov 25 14:50:27 CET 2021)
    Setting up analysis session
    plugin: com.sun.script.javascript.RhinoScriptEngine message: Error calling run in C:\ti\ccsv6\ccs_base\common\analysis\scripts\CoreTrace.js at line number: 51:
    sun.org.mozilla.javascript.internal.WrappedException: Wrapped java.lang.NullPointerException (<Unknown source>#51) in <Unknown source> at line number 51: sun.org.mozilla.javascript.internal.WrappedException: Wrapped java.lang.NullPointerException (<Unknown source>#51) in <Unknown source> at line number 51
    javax.script.ScriptException: sun.org.mozilla.javascript.internal.WrappedException: Wrapped java.lang.NullPointerException (<Unknown source>#51) in <Unknown source> at line number 51
    at com.sun.script.javascript.RhinoScriptEngine.invoke(RhinoScriptEngine.java:300)
    at com.sun.script.javascript.RhinoScriptEngine.invokeFunction(RhinoScriptEngine.java:258)
    at com.ti.dvt.analysis.tasks.Import$ImportTarget.execute(Import.java:291)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ControlTaskRunner.run(ControlTaskRunner.java:540)
    at org.apache.tools.ControlTaskRunner.run(ControlTaskRunner.java:497)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.ti.dvt.control.engine.core.ControlEngineRunner.run(ControlEngineRunner.java:545)
    at com.ti.dvt.control.engine.core.ControlEngineRunner.run(ControlEngineRunner.java:497)
    at com.ti.dvt.control.engine.activities.controlxml.ControlXMLActivity.callMethod(ControlXMLActivity.java:242)
    at com.ti.dvt.control.engine.activities.controlxml.ControlXMLActivity.callMethod(ControlXMLActivity.java:281)
    at com.ti.dvt.control.engine.activities.controlxml.ControlFileActivity.run(ControlFileActivity.java:257)
    at com.ti.dvt.engine.scripting.ScriptAnalysisSession$ScriptActivity.run(ScriptAnalysisSession.java:275)
    at com.ti.dvt.engine.scripting.ScriptAnalysisSession$ScriptAnalysis.run(ScriptAnalysisSession.java:564)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:145)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:204)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3085)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
    at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:172)
    at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:503)
    at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:425)
    at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:391)
    at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:382)
    at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:179)
    at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:100)
    at org.mozilla.javascript.Context.call(Context.java:528)
    at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:450)
    at org.mozilla.javascript.tools.shell.Main.exec(Main.java:162)
    at org.mozilla.javascript.tools.debugger.Main.main(Main.java:255)
    at com.ti.ccstudio.apps.internal.scripting.RunScript$1.run(RunScript.java:86)
    Caused by: sun.org.mozilla.javascript.internal.WrappedException: Wrapped java.lang.NullPointerException (<Unknown source>#51)
    at sun.org.mozilla.javascript.internal.Context.throwAsScriptRuntimeEx(Context.java:1808)
    at sun.org.mozilla.javascript.internal.MemberBox.invoke(MemberBox.java:196)
    at sun.org.mozilla.javascript.internal.NativeJavaMethod.call(NativeJavaMethod.java:245)
    at sun.org.mozilla.javascript.internal.Interpreter.interpretLoop(Interpreter.java:1706)
    at sun.org.mozilla.javascript.internal.Interpreter.interpret(Interpreter.java:849)
    at sun.org.mozilla.javascript.internal.InterpretedFunction.call(InterpretedFunction.java:162)
    at sun.org.mozilla.javascript.internal.ContextFactory.doTopCall(ContextFactory.java:430)
    at com.sun.script.javascript.RhinoScriptEngine$1.superDoTopCall(RhinoScriptEngine.java:116)
    at com.sun.script.javascript.RhinoScriptEngine$1.doTopCall(RhinoScriptEngine.java:109)
    at sun.org.mozilla.javascript.internal.ScriptRuntime.doTopCall(ScriptRuntime.java:3160)
    at sun.org.mozilla.javascript.internal.InterpretedFunction.call(InterpretedFunction.java:160)
    at com.sun.script.javascript.RhinoScriptEngine.invoke(RhinoScriptEngine.java:294)
    ... 43 more
    Caused by: java.lang.NullPointerException
    at com.ti.dvt.analysis.suite.usecasehelpers.TraceUseCaseHelper.isSimulator(TraceUseCaseHelper.java:1452)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at sun.org.mozilla.javascript.internal.MemberBox.invoke(MemberBox.java:167)
    ... 53 more
    Running target

  • Should we setup any environment variables ? Run the command prompt in Admin mode ? what is the WINDOWS OS etc ? .

    Should we execute the scripts on WINDOWS 7 ? any requirement of WINDOWS updates ? . I am executing this script on WINDOWS 10 .

    Yes, Windows 10 is fine. I am using Windows 10.

    My Windows version is 20H2 (build 19042.1348). I do not think that the issue you see if because of your Windows version

    There are no additional setup needed.

    The error looks different this time. It is failing with the protrace configuration for trace. Please attach your latest version of the script. 

    Thanks

    ki

  • importPackage(Packages.com.ti.debug.engine.scripting)
    importPackage(Packages.com.ti.ccstudio.scripting.environment)
    importPackage(Packages.com.ti.dvt.engine.scripting)
    importPackage(Packages.java.lang)
    importPackage(Packages.java.io)
    importPackage(Packages.java.util)
    
    /*
     * This file contains an example for running Code Coverage Analysis on a C6670 board over XDSPRO
     * It enables the Merge option for Code Coverage and merge data from 2 runs.
     *
     * The example will export processed data to CSV files locate in CWD (Current Working Directory).
     *
     * See /ccs_base/scripting/docs/DVTAnalyzerScripting.htm for complete details on 
     * Hardware Trace Analyzer scripting 
     */
    
    // ---------- Start up ----------
    script = ScriptingEnvironment.instance();
    script.setScriptTimeout(240000);
    
    // Create a log file in the current directory to log script execution
    script.traceBegin("scriptLog.xml", "DefaultStylesheet.xsl");
    script.traceSetConsoleLevel(TraceLevel.INFO);
    script.traceSetFileLevel(TraceLevel.INFO);
    
    script.traceWrite("Starting Code Coverage");
    
    // ---------- Set up debugger ----------
    script.traceWrite("Launching debugger");
    debugServer = script.getServer("DebugServer.1");
    debugServer.setConfig("c:/Users/Kalvacherla/Documents/200800_sgpcu_Sprint_CK/04 - Software/04 - SW SRC/RM48/PSP/Platforms/Native/Hercules/projects/SIL2PSP_Extension_RM48L952/RM48L952.ccxml");
    dsR5 = debugServer.openSession("Spectrum Digital XDSPRO USB Emulator_0/CortexR4"); 
    
    script.traceWrite("Connecting CPU");
    dsR5.target.connect();
    
    script.traceWrite("Loading program");
    
    try {
            dsR5.memory.loadProgram("c:/Users/Kalvacherla/Documents/200800_sgpcu_Sprint_CK/04 - Software/04 - SW SRC/RM48/PSP/Platforms/Native/Hercules/projects/SIL2PSP_Extension_RM48L952/Debug/SIL2PSP_Extension_RM48L952.out");
    } catch (ex) {
            dssScriptEnv.traceWrite(testProgFile + " does not exist! Aborting script");
            quit();         // call custom quit routine to do some cleanup to gracefully exit the script
    }
    
    // ---------- Create a DVT server ----------
    dvtServer = script.getServer("DVTServer.1");
    
    // ---------- Set up the analysis ----------
    script.traceWrite("Setting up analysis session");
    analysisSession = dvtServer.openAnalysisSession();
    
    analysisConfig = analysisSession.loadAnalysis("Hardware Trace Analyzer/Code Coverage");
    analysisConfig.setProperty("cores", dsR5.getName());
    analysisConfig.setProperty("transportType", "Pro Trace");
    analysisConfig.setProperty("bufferSize", "512 kB");
    
    
    analysisConfig.run();
    
    //---------- Run target for 2 secs ----------
    script.traceWrite("Running target");
    //dsR5.target.runAsynch();
    //Thread.sleep(2000);
    //dsR5.target.halt();
    dsR5.target.run();
    
    // ---------- Wait until processing is done  ----------
    script.traceWrite("Processing");
    analyzer = analysisConfig.findAnalyzerByName("Code Coverage");
    analyzer.waitForEndOfData();
    
    
    // ---------- Post analysis - export the data to a CSV file ----------
    cwd = script.getCurrentDirectory();
    script.traceWrite("Exporting results to " + cwd);
    analyzer.exportDataToCSV("Line Coverage", cwd+"/"+"LineCoverageLive.csv", null);
    analyzer.exportDataToCSV("Function Coverage", cwd+"/"+"FunctionCoverageLive.csv", null);
    
    //---------- Again run target for 2 secs ----------
    script.traceWrite("Running target again");
    dsC66_0.target.restart();
    dsC66_0.target.runAsynch();
    Thread.sleep(2000);
    dsC66_0.target.halt();
    
    // ---------- Wait until processing is done  ----------
    script.traceWrite("Processing (merging with existing code coverage statistics)");
    analyzer.waitForEndOfData();
    
    // ---------- Post analysis - export merged result to a CSV file ----------
    cwd = script.getCurrentDirectory();
    script.traceWrite("Exporting results to " + cwd);
    analyzer.exportDataToCSV("Line Coverage", cwd+"/"+"LineCoverageLive_Merged.csv", null);
    analyzer.exportDataToCSV("Function Coverage", cwd+"/"+"FunctionCoverageLive_Merged.csv", null);
    // ---------- shut down ----------
    script.traceWrite("Shutting down");
    analysisSession.endAnalysis(analysisConfig);
    debugServer.stop();
    dvtServer.stop();
    script.traceEnd();
    

  • Can you trychanging the buffer size to 64 kB on line 57?

  • I have update the .js script as Below and executed the script  . 

    importPackage(Packages.com.ti.debug.engine.scripting)
    importPackage(Packages.com.ti.ccstudio.scripting.environment)
    importPackage(Packages.com.ti.dvt.engine.scripting)
    importPackage(Packages.java.lang)
    importPackage(Packages.java.io)
    importPackage(Packages.java.util)
    
    /*
     * This file contains an example for running Code Coverage Analysis on a C6670 board over XDSPRO
     * The example will export processed data to CSV files locate in CWD (Current Working Directory).
     *
     * See /ccs_base/scripting/docs/DVTAnalyzerScripting.htm for complete details on 
     * Hardware Trace Analyzer scripting 
     */
    
    // ---------- Start up ----------
    script = ScriptingEnvironment.instance();
    script.setScriptTimeout(240000);
    
    // Create a log file in the current directory to log script execution
    script.traceBegin("scriptLog.xml", "DefaultStylesheet.xsl");
    script.traceSetConsoleLevel(TraceLevel.INFO);
    script.traceSetFileLevel(TraceLevel.INFO);
    
    script.traceWrite("Starting Code Coverage");
    
    // ---------- Set up debugger ----------
    script.traceWrite("Launching debugger");
    debugServer = script.getServer("DebugServer.1");
    debugServer.setConfig("c:/Users/Kalvacherla/Documents/200800_sgpcu_Sprint_CK/04 - Software/04 - SW SRC/RM48/PSP/Platforms/Native/Hercules/projects/SIL2PSP_Extension_RM48L952/RM48L952.ccxml");
    dsR5 = debugServer.openSession("*", "*"); 
    
    script.traceWrite("Connecting CPU");
    dsR5.target.connect();
    
    script.traceWrite("Loading program");
    //dsR5.memory.loadProgram("c:/Users/Kalvacherla/Documents/200800_sgpcu_Sprint_CK/04 - Software/04 - SW SRC/RM48/PSP/Platforms/Native/Hercules/projects/SIL2PSP_Extension_RM48L952/Debug/SIL2PSP_Extension_RM48L952.out");
    
    // ---------- Create a DVT server ----------
    dvtServer = script.getServer("DVTServer.1");
    
    // ---------- Set up the analysis ----------
    script.traceWrite("Setting up analysis session");
    analysisSession = dvtServer.openAnalysisSession();
    
    analysisConfig = analysisSession.loadAnalysis("Hardware Trace Analyzer/Code Coverage");
    analysisConfig.setProperty("core", dsR5.getName());
    analysisConfig.setProperty("transportType", "Pro Trace");
    analysisConfig.setProperty("bufferSize", "64 kB");
    
    analysisConfig.run();
    
    //---------- Run target for 2 secs ----------
    script.traceWrite("Running target");
    //dsR5.target.runAsynch();
    //Thread.sleep(2000);
    //dsR5.target.halt();
    dsR5.target.run();
    
    // ---------- Wait until processing is done  ----------
    script.traceWrite("Processing");
    analyzer = analysisConfig.findAnalyzerByName("Code Coverage");
    analyzer.waitForEndOfData();
    
    
    // ---------- Post analysis - export the data to a CSV file ----------
    cwd = script.getCurrentDirectory();
    script.traceWrite("Exporting results to " + cwd);
    analyzer.exportDataToCSV("Line Coverage", cwd+"/"+"LineCoverageLive.csv", null);
    analyzer.exportDataToCSV("Function Coverage", cwd+"/"+"FunctionCoverageLive.csv", null);
    
    // ---------- shut down ----------
    script.traceWrite("Shutting down");
    analysisSession.endAnalysis(analysisConfig);
    debugServer.stop();
    dvtServer.stop();
    script.traceEnd();
    

    Attached below is the XML script_log

    <?xml version="1.0" encoding="windows-1252" standalone="no"?>
    <?xml-stylesheet type="text/xsl" href="DefaultStylesheet.xsl"?>
    <log>
    <record>
      <date>2021-11-25T17:12:51</date>
      <millis>1637856771210</millis>
      <sequence>7</sequence>
      <logger>com.ti</logger>
      <level>INFO</level>
      <class>com.ti.ccstudio.scripting.environment.ScriptingEnvironment</class>
      <method>traceWrite</method>
      <thread>26</thread>
      <message>Starting Code Coverage</message>
    </record>
    <record>
      <date>2021-11-25T17:12:51</date>
      <millis>1637856771211</millis>
      <sequence>8</sequence>
      <logger>com.ti</logger>
      <level>INFO</level>
      <class>com.ti.ccstudio.scripting.environment.ScriptingEnvironment</class>
      <method>traceWrite</method>
      <thread>26</thread>
      <message>Launching debugger</message>
    </record>
    <record>
      <date>2021-11-25T17:13:05</date>
      <millis>1637856785810</millis>
      <sequence>53</sequence>
      <logger>com.ti</logger>
      <level>INFO</level>
      <class>com.ti.ccstudio.scripting.environment.ScriptingEnvironment</class>
      <method>traceWrite</method>
      <thread>26</thread>
      <message>Connecting CPU</message>
    </record>
    <record>
      <date>2021-11-25T17:13:06</date>
      <millis>1637856786396</millis>
      <sequence>60</sequence>
      <logger>com.ti.debug.engine.scripting.DebugSession</logger>
      <level>INFO</level>
      <class>com.ti.debug.engine.scripting.DebugSession$DebuggerInfoListener</class>
      <method>onEvent</method>
      <thread>41</thread>
      <message>CortexR4: GEL Output: 	Memory Map Setup for Flash @ Address 0x0</message>
    </record>
    <record>
      <date>2021-11-25T17:13:06</date>
      <millis>1637856786427</millis>
      <sequence>67</sequence>
      <logger>com.ti</logger>
      <level>INFO</level>
      <class>com.ti.ccstudio.scripting.environment.ScriptingEnvironment</class>
      <method>traceWrite</method>
      <thread>26</thread>
      <message>Loading program</message>
    </record>
    <record>
      <date>2021-11-25T17:13:06</date>
      <millis>1637856786594</millis>
      <sequence>76</sequence>
      <logger>com.ti</logger>
      <level>INFO</level>
      <class>com.ti.ccstudio.scripting.environment.ScriptingEnvironment</class>
      <method>traceWrite</method>
      <thread>26</thread>
      <message>Setting up analysis session</message>
    </record>
    <record>
      <date>2021-11-25T17:13:55</date>
      <millis>1637856835041</millis>
      <sequence>77</sequence>
      <logger>com.ti</logger>
      <level>INFO</level>
      <class>com.ti.ccstudio.scripting.environment.ScriptingEnvironment</class>
      <method>traceWrite</method>
      <thread>26</thread>
      <message>Running target</message>
    </record>
    <record>
      <date>2021-11-25T17:18:00</date>
      <millis>1637857080981</millis>
      <sequence>81</sequence>
      <logger>com.ti.ccstudio.scripting.environment.ScriptingException</logger>
      <level>SEVERE</level>
      <class>com.ti.ccstudio.scripting.environment.ScriptingException</class>
      <method>logException</method>
      <thread>26</thread>
      <message>Timed out after 240000ms</message>
      <exception>
        <message>com.ti.ccstudio.scripting.environment.ScriptingException: Timed out after 240000ms</message>
        <frame>
          <class>com.ti.debug.engine.scripting.AbstractListener</class>
          <method>waitUntil</method>
          <line>76</line>
        </frame>
        <frame>
          <class>com.ti.debug.engine.scripting.AbstractListener</class>
          <method>waitUntil</method>
          <line>87</line>
        </frame>
        <frame>
          <class>com.ti.debug.engine.scripting.ExecutionOperation</class>
          <method>go</method>
          <line>57</line>
        </frame>
        <frame>
          <class>com.ti.debug.engine.scripting.Target</class>
          <method>run</method>
          <line>782</line>
        </frame>
        <frame>
          <class>sun.reflect.NativeMethodAccessorImpl</class>
          <method>invoke0</method>
        </frame>
        <frame>
          <class>sun.reflect.NativeMethodAccessorImpl</class>
          <method>invoke</method>
          <line>57</line>
        </frame>
        <frame>
          <class>sun.reflect.DelegatingMethodAccessorImpl</class>
          <method>invoke</method>
          <line>43</line>
        </frame>
        <frame>
          <class>java.lang.reflect.Method</class>
          <method>invoke</method>
          <line>606</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.MemberBox</class>
          <method>invoke</method>
          <line>145</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.NativeJavaMethod</class>
          <method>call</method>
          <line>204</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.Interpreter</class>
          <method>interpretLoop</method>
          <line>3085</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.Interpreter</class>
          <method>interpret</method>
          <line>2251</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.InterpretedFunction</class>
          <method>call</method>
          <line>161</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.ContextFactory</class>
          <method>doTopCall</method>
          <line>340</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.ScriptRuntime</class>
          <method>doTopCall</method>
          <line>2758</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.InterpretedFunction</class>
          <method>exec</method>
          <line>172</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main</class>
          <method>evaluateScript</method>
          <line>503</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main</class>
          <method>processFileSecure</method>
          <line>425</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main</class>
          <method>processFile</method>
          <line>391</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main</class>
          <method>processSource</method>
          <line>382</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main</class>
          <method>processFiles</method>
          <line>179</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main$IProxy</class>
          <method>run</method>
          <line>100</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.Context</class>
          <method>call</method>
          <line>528</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.ContextFactory</class>
          <method>call</method>
          <line>450</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main</class>
          <method>exec</method>
          <line>162</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.debugger.Main</class>
          <method>main</method>
          <line>255</line>
        </frame>
        <frame>
          <class>com.ti.ccstudio.apps.internal.scripting.RunScript$1</class>
          <method>run</method>
          <line>86</line>
        </frame>
      </exception>
    </record>
    <record>
      <date>2021-11-25T17:18:00</date>
      <millis>1637857080983</millis>
      <sequence>82</sequence>
      <logger>com.ti.ccstudio.scripting.environment.ScriptingException</logger>
      <level>SEVERE</level>
      <class>com.ti.ccstudio.scripting.environment.ScriptingException</class>
      <method>logException</method>
      <thread>26</thread>
      <message>com.ti.debug.engine.scripting.Target.run(): Timed out after 240000ms</message>
      <exception>
        <message>com.ti.ccstudio.scripting.environment.ScriptingException: com.ti.debug.engine.scripting.Target.run(): Timed out after 240000ms</message>
        <frame>
          <class>com.ti.debug.engine.scripting.ExecutionOperation</class>
          <method>go</method>
          <line>68</line>
        </frame>
        <frame>
          <class>com.ti.debug.engine.scripting.Target</class>
          <method>run</method>
          <line>782</line>
        </frame>
        <frame>
          <class>sun.reflect.NativeMethodAccessorImpl</class>
          <method>invoke0</method>
        </frame>
        <frame>
          <class>sun.reflect.NativeMethodAccessorImpl</class>
          <method>invoke</method>
          <line>57</line>
        </frame>
        <frame>
          <class>sun.reflect.DelegatingMethodAccessorImpl</class>
          <method>invoke</method>
          <line>43</line>
        </frame>
        <frame>
          <class>java.lang.reflect.Method</class>
          <method>invoke</method>
          <line>606</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.MemberBox</class>
          <method>invoke</method>
          <line>145</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.NativeJavaMethod</class>
          <method>call</method>
          <line>204</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.Interpreter</class>
          <method>interpretLoop</method>
          <line>3085</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.Interpreter</class>
          <method>interpret</method>
          <line>2251</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.InterpretedFunction</class>
          <method>call</method>
          <line>161</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.ContextFactory</class>
          <method>doTopCall</method>
          <line>340</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.ScriptRuntime</class>
          <method>doTopCall</method>
          <line>2758</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.InterpretedFunction</class>
          <method>exec</method>
          <line>172</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main</class>
          <method>evaluateScript</method>
          <line>503</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main</class>
          <method>processFileSecure</method>
          <line>425</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main</class>
          <method>processFile</method>
          <line>391</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main</class>
          <method>processSource</method>
          <line>382</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main</class>
          <method>processFiles</method>
          <line>179</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main$IProxy</class>
          <method>run</method>
          <line>100</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.Context</class>
          <method>call</method>
          <line>528</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.ContextFactory</class>
          <method>call</method>
          <line>450</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.shell.Main</class>
          <method>exec</method>
          <line>162</line>
        </frame>
        <frame>
          <class>org.mozilla.javascript.tools.debugger.Main</class>
          <method>main</method>
          <line>255</line>
        </frame>
        <frame>
          <class>com.ti.ccstudio.apps.internal.scripting.RunScript$1</class>
          <method>run</method>
          <line>86</line>
        </frame>
      </exception>
    </record>
    </log> 

  • Can you also let me know what version of CCS you are using , I am using CCS 6.2.0

  • I'm using 6.2.0 also.

    The last error message is more promising:

    <message>com.ti.ccstudio.scripting.environment.ScriptingException: Timed out after 240000ms</message>

    Looks like your application is indefintely running and hence you are getting the script timeout exception of 240 seconds. My program terminates running on its own after a few seconds so I can use a synchronous run. In your case, you'll need to do an asynchronous run and then wait for a few seconds before explicitly calling a halt. Basically those are lines 55-57 which are commented out in the script. You can uncomment those and then comment line 58. You can changethe value in the thread sleep call to whatever value you wish to set the wait time.