Other Parts Discussed in Thread: CCSTUDIO
Tool/software:
I'm trying to debug using DSS scripting (attached js file) referring https://software-dl.ti.com/ccs/esd/documents/dss_launching_ccs_from_dss.html.
// Import TI DSS packages
importPackage(Packages.com.ti.debug.engine.scripting);
importPackage(Packages.com.ti.ccstudio.scripting.environment);
importPackage(Packages.java.lang);
// Read command line arguments
var argsFromHost = arguments;
if (argsFromHost.length < 2) {
print("Usage: dss.bat load_and_run_c7x.js <.ccxml> <app.out> [args...]");
quit(1);
}
var ccxmlPath = argsFromHost[0];
var appPath = argsFromHost[1];
var appArgs = Array.prototype.slice.call(argsFromHost, 2);
print("+ ==== TI DSS Script: load_and_debug_c7x.js ==== +");
print("This script loads the program and halts at main() ");
print("then you can connect to CCS for debugging ");
print("+ ============================================== +");
print("App path received: " + appPath);
print("CCXML path received: " + ccxmlPath);
if (appArgs.length > 0) {
appArgs.unshift(appPath);
print("App arguments: " + appArgs.join(" "));
} else {
print("No App arguments passed.");
}
// Initialize DSS scripting environment
var script = ScriptingEnvironment.instance();
// Start up CCS
var ccsServer = script.getServer("CCSServer.1")
var ccsSession = ccsServer.openSession(".*")
var debugServer = script.getServer("DebugServer.1");
var debugSession;
try {
// Preemptively stop any existing sessions
try {
debugServer.stop();
} catch (err) {
print("Warning: debugServer.stop() failed: " + err);
}
print("Setting up debug server...");
debugServer.setConfig(ccxmlPath);
try {
debugSession = debugServer.openSession("Texas Instruments XDS110 USB Debug Probe/C75X_0");
} catch (err) {
print("ERROR: Unable to open debug session. Is the target connected and powered on?");
print("Original error: " + err);
quit(1);
}
print("Connecting to target...");
debugSession.target.connect();
print("Halting target...");
debugSession.target.halt();
print("Resetting target...");
debugSession.target.reset();
java.lang.Thread.sleep(10000); // Allow hardware reset to complete
print("Loading program: " + appPath);
debugSession.memory.loadProgram(appPath, appArgs);
// Set a breakpoint at "main"
print("Setting breakpoint at main() ");
var main = debugSession.symbol.getAddress("main")
var bp1 = debugSession.breakpoint.add(main)
// Restart our Target
debugSession.target.restart()
// Run if already not automatically halted at main. Should halt at first BP
if(debugSession.expression.evaluate("PC") != main)
{
debugSession.target.run()
}
// Using an expression - get the current value of the PC
nPC = debugSession.expression.evaluate("PC")
if (nPC == main) {
print("Breakpoint hit at 'main'. You can now attach CCS and debug.");
} else {
print("Timeout waiting for 'main'.");
}
} catch (error) {
print("ERROR: " + error);
if(debugServer != null){
try {
ccsServer.stop();
debugServer.stop();
} catch (err) {
print("Warning: Failed to stop debug server: " + err);
}
}
print("Execution failed.");
quit(1);
}
I'm facing the below error:
```
CCXML path received: C:/REPO/RTCORE/01/rtcore/toolchain/common/ti/am275/AM275X_XDS110.ccxml
No App arguments passed.
WARNING: CCSServer.openSession() failed. DSS was unable to launch Code Composer Studio, however script execution will continue. java.lang.ClassNotFoundException: com.ti.ccstudio.apps.scripting.ScriptUtils
```
Because of that I'm not able to debug further. Is there any recommended solution on resolving this? OR Is there a way to attach the CCS to debug via CCS scripting ie. nodejs based.
----
Regarding the latest CSS scripting console, load program in DSS scripting allows to pass argument via load_program as below:
But via Scripting console if I try:
```
js:> const session = ds.openSession("Texas Instruments XDS110 USB Debug Probe/C75X_0");
undefined
js:> session.target.connect();
undefined
js:> session.memory.loadProgram("C:/TI_APP/test_app.out" 64);
session.memory.loadProgram(""C:/TI_APP/test_app.out" 64);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Uncaught SyntaxError: missing ) after argument list
```
So how should I pass the arguments to main in new scripting console?