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: Complex project structure have to collect Code Coverage Report Continiously while executing halt the processor and Merge code Coverage Report

Part Number: RM48L952
Other Parts Discussed in Thread: CCSTUDIO

Hi , 

Using XDSPRO to capture line coverage and Function Coverage report for Complex projects . 

1) We are able to run a simle for loop project after completion of for loop to get the Code Coverage Report , attached simple project that completes execution and that halts after known time period and has no while loops or complex project structure . 

bin.zip

We are not able to achive the following using scripting :

Erase the contents of the FLASH on RM48L952.

1) Flash / Load .out file of with Complex project  structure with multiple while loops etc Processor can halt while executing , XDSPRO have to collect Code Coverage Continiously any condition while executing the RM48L952 or getting halt etc . 

2) After completion of first step the XDSPRO should halt the processor and Merge code Coverage Report . 

3) Load the project with different operating conditional settings

4) After completion of step 3 the XDSPRO should halt the processor and Merge code Coverage Report . 

5) Load the project with HARDWARE IN LOOP testing conditional 

6) After completion of step 5 the XDSPRO should halt the processor and Merge code Coverage Report . 

7) there can be multiple loops of execution of above mentioned steps different INPUT test conditions / Code Settings etc all conditionts it should Merge code Coverage Report  and generate final report

8) Due to lot of data to be collected from the complex project the XDSPRO halts and exits the script at following line , the data should be split to small 512kb chunks and writen to .csv files time to time 

The script is as follows

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/ccsv6/ccs_base/scripting/bin/RM48L952.ccxml");
dsR5 = debugServer.openSession("*", "*"); 

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

script.traceWrite("Loading program");
//dsR5.memory.loadProgram("Compiled/TESTXDSPRO.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", "512 kB");
analysisConfig.setProperty("Number of Pins", "8 Pin");

analysisConfig.run();

//---------- Run target for 2 secs ----------
script.traceWrite("Running target");
dsR5.target.halt();
dsR5.target.runAsynch();
Thread.sleep(20000);
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();

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/ccsv6/ccs_base/scripting/bin/RM48L952.ccxml");
dsR5 = debugServer.openSession("*", "*");

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

script.traceWrite("Loading program");
//dsR5.memory.loadProgram("Compiled/TESTXDSPRO.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", "512 kB");
analysisConfig.setProperty("Number of Pins", "8 Pin");

analysisConfig.run();

//---------- Run target for 2 secs ----------
script.traceWrite("Running target");
dsR5.target.halt();
dsR5.target.runAsynch();
Thread.sleep(20000);
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();