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.

TMDSCNCD28035ISO: Getting "TypeError: Cannot call method "getActivity" of undefined " when trying to profile code

Part Number: TMDSCNCD28035ISO

Hi

I currently have this Piccolo TMS320F28035 Isolated controlCARD.

Card:

http://www.ti.com/tool/TMDSCNCD28035ISO

Docking Station:

https://www.ti.com/tool/TMDSDOCK28035

Micro Inverter Baseboard:

http://www.ti.com/tool/TMDSSOLARUINVKIT

I am trying to write a javascript file that I can run on the scripting console in CCS to profile my code.

I am using this user guide and supplied video (7.6 Scripting DDS Overview video) to write the script:

https://software-dl.ti.com/ccs/esd/documents/users_guide/sdto_dss_handbook.html#profiling

I was able to follow along in the video to write a javascript just like in the video. I am now trying to add profiling capabilities and dump it in a file (just like in the 7.6.11). 

I keep getting "TypeError: Cannot call method "getActivity" of undefined"  which means I am not setting up myProfileActivity correctly?

Lastly, the user guide said that in my ccs installation path of "\ccs\ccs_base\scripting\examples" would have some "DVTExamples" sample code for profiling, but this is not existing in my folder?

Any help would be appreciated, thanks!

importPackage(Packages.com.ti.debug.engine.scripting);
importPackage(Packages.com.ti.ccstudio.scripting.environment);
importPackage (Packages.java.lang);

var ccs9InstallDir = "C:/Users/A/Desktop/Code Composer";
var deviceCCXMLFile = "C:/Users/A/Desktop/Code Composer/Workspace5/SolarMicroInv_F2803x/xds100v1_F28035.ccxml";
var programToLoad = "C:/Users/A/Desktop/Code Composer/Workspace5/SolarMicroInv_F2803x/F2803x_FLASH/SolarMicroInv_F2803x.out";
var logFile = "C:/Users/A/Desktop/newcontrolsuite/controlSUITE/development_kits/TMDSSOLARUINVKIT_v100/MicroInv_F2803x/log.xml";


var script = ScriptingEnvironment.instance();

script.traceBegin(logFile, "C:/Users/A/Desktop/Code Composer/ccs/ccs_base/scripting/examples/DebugServerExamples/DefaultStylesheet.xsl");
script.traceSetConsoleLevel(TraceLevel.INFO);
script.traceSetFileLevel(TraceLevel.ALL);

script.traceWrite("Begin scripting session");

var debugServer = script.getServer("DebugServer.1");
debugServer.setConfig(deviceCCXMLFile);

debugSession = debugServer.openSession("Texas Instruments XDS100v1 USB Emulator_0/C28xx");
debugSession.target.connect();
debugSession.memory.loadProgram(programToLoad);


// array of events to be profiled ------------------take from TI user guide 
var evtNames = new Array("Events.L1D.hit.summary",
                         "Events.L1D.miss.summary",
                         "Events.L1D.miss.conflict",
                         "Events.L1D.miss.non_conflict",
                         "Events.L1P.miss.summary",
                         "Events.CPU.stall.mem.L1D",
                         "Events.CPU.stall.mem.L1P",
                         "Events.L1P.hit"
                         );


// User guide code
myProfileActivity= debugSession.profileSetup.getActivity("Profile all Functions for Total Cycles");

// enable profiling of all events in the array - User guide code
for (evtCount=0;evtCount<evtNames.length;evtCount++)
{
    event = myProfileActivity.getProperty(evtNames[evtCount]);
    event.setBoolean(true);

}
myProfileActivity.setStatus(true);

// User guide code - already set up events to profile, now set up way to export them
dvtServer = script.getServer("DVTServer.1");

// create a profile analysis session for function level profiling data collected
var profileAnalysisSession = dvtServer.openProfileAnalysisSession(debugSession, "FunctionProfile");

// use Asynch otherwise, it runs forever
//debugSession.target.run();
debugSession.target.runAsynch();

profileAnalysisSession.waitUntilProfilingComplete();

var exports = profileAnalysisSession.exportData();

for (var e=0; e < exports.length; e++)
{
    exports[e].save(exports[e].getName() + ".csv");
}


// close profile session
profileAnalysisSession.terminate();
dvtServer.stop();
debugServer.stop();
script.traceWrite("End scripting session");
script.traceEnd();