// Import the DSS packages into our namespace to save on typing importPackage(Packages.com.ti.debug.engine.scripting) importPackage(Packages.com.ti.ccstudio.scripting.environment) importPackage(Packages.java.lang) // Create our scripting environment object - which is the main entry point into any script and // the factory for creating other Scriptable ervers and Sessions var script = ScriptingEnvironment.instance() // Create a log file in the current directory to log script execution script.traceBegin("UnitTestsLog.xml", "DefaultStylesheet.xsl") // Log everything script.traceSetConsoleLevel(TraceLevel.ALL) script.traceSetFileLevel(TraceLevel.ALL) // Get the name of our ISA - used to build the path to the OUT file //var isaName = Target.ISA.lookupISA(debugSession.getMajorISA()) //var workspacePath = "e:/PyrocamIV/Sources" //var configPath = workspacePath + "/UnitTests/sim6748.ccxml" var configPath = "../../../CCSTargetConfigurations/sim6748.ccxml" // Get the Debug Server and start a Debug Session debugServer = script.getServer("DebugServer.1") debugServer.setConfig(configPath); debugSession = debugServer.openSession(".*") if (debugSession.getMajorISA() != 0x64) { // Requires a C64x (for now) script.traceSetConsoleLevel(TraceLevel.INFO) script.traceWrite("Test requires a C64x!") script.traceWrite("TEST FAILED!") script.traceEnd() java.lang.System.exit(1); } // Change timeout from the default (infinite) to 15 seconds script.setScriptTimeout(180000); // Load a program // (ScriptingEnvironment has a concept of a working folder and for all of the APIs which take // path names as arguments you can either pass a relative path or an absolute path) //debugSession.memory.loadProgram(workspacePath + "/UnitTests/Debug/UnitTests.out") debugSession.memory.loadProgram("../Debug/UnitTests.out") // Restart, and go to main. If the target is configured to go to main on restart, then restarting // should be sufficient. Otherwise we will need to also set a breakpoint at main and run to it. debugSession.target.restart() var addressMain = debugSession.symbol.getAddress("main") if (debugSession.memory.readRegister("PC") != addressMain) { var bp = debugSession.breakpoint.add(addressMain) debugSession.target.run() } // run from main() debugSession.target.run() // All done debugServer.stop() script.traceSetConsoleLevel(TraceLevel.INFO) script.traceWrite("TEST SUCCEEDED!") // Stop logging and exit. script.traceEnd() java.lang.System.exit(0);