Other Parts Discussed in Thread: CCSTUDIO
I am unable to run my script twice. The first run is OK but when I run it the second time it hang and an eclipseC process is running forever. I have to kill it and turn OFF/ON the target
Note when running my scrip only once then run CCS5+connect to target then exit from CCS5(with target terminate) then my script can run again only once without resetting the target or killing any process.
Can you tell me where I am wrong with my script ?
my DSS script run as "DSS add.js" from a cmd window, looks like:
// Import the DSS packages into namespace
importPackage(Packages.com.ti.debug.engine.scripting)
importPackage(Packages.com.ti.ccstudio.scripting.environment)
importPackage(Packages.java.lang)
importPackage(Packages.java.io)
// Get scripting environment object
var script = ScriptingEnvironment.instance()
// Log everything
script.traceSetConsoleLevel(TraceLevel.INFO)
//// Set timeout
//script.setScriptTimeout(300000)
// Get the Debug Server and start a Debug Session
var debugServer = script.getServer("DebugServer.1")
debugServer.setConfig("C:\\TestRT\\targets\\CWINCC~1\\CCS\\C2000.ccxml");
var debugSession = debugServer.openSession("Spectrum Digital C2000 XDS510LC Emulator_0","C28xx")
//connect to target
script.traceWrite("target.connect..")
debugSession.target.connect()
//debugSession.target.reset()
// Load executable
script.traceWrite("loading 'add.out'...")
debugSession.memory.loadProgram(".\\cwinccs5c2000\\add.out")
// Set breakpoints
var mycont = debugSession.symbol.getAddress("priv_writeln")
var myclose = debugSession.symbol.getAddress("priv_close")
var brk1 = debugSession.breakpoint.add(mycont)
var brk2 = debugSession.breakpoint.add(myclose)
// Run loop
script.traceWrite("running...")
//debugSession.target.restart()
//debugSession.target.reset()
while (true) {
debugSession.target.run()
script.traceWrite("code break")
if (debugSession.memory.readRegister("PC") == mycont) {
script.traceWrite("exec Code continue")
continue
} else {
// Hit breakpoint: terminate execution
script.traceWrite("exec Code ends")
break
}
}
// All done
script.traceWrite("reset...")
debugSession.target.reset();
debugSession.terminate()
debugServer.stop()
script.traceWrite("debugServer.stopped.")
// Stop logging and exit.
script.traceEnd()
System.exit(0);