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.

TMDSCNCD280025C: Unable to download executable using CCSv1030

Part Number: TMDSCNCD280025C

HI All,

I used to download the executable using the following command format using dss.bat which was working fine till CCS v1010

C:\ti\ccs1010\ccs\ccs_base\SCRIPT~1/bin/dss.bat <SCRIPTINGPATH>/runProgram_generic.js <CCXMLFILE> <EXECUTABLENAMEWITHPATH> "*" C28xx_CPU1 "TI_F28002x" "*"'

But starting from CCS v1030,the arguments I am passing after javascript file is not at all considered and getting the error because of that.

C:\ti\ccs1030\ccs\ccs_base\SCRIPT~1/bin/dss.bat <SCRIPTINGPATH>/runProgram_generic.js <CCXMLFILE> <EXECUTABLENAMEWITHPATH> "*" C28xx_CPU1 "TI_F28002x" "*"'

*** User inputs:
Target Configuration: undefined
Program Name: undefined
Board Name: unspecified (connect to first board)
CPU Name: unspecified (connect to first CPU)

*** Starting debug session...
SEVERE: Cannot read System Setup data from XML file 

Though I am maintaining the same order as recommended by the usage example 

Usage: dss [-dss.debug] [-dss.workspace WORKPLACE_FOLDER] DSS_JAVASCRIPT_FILE  [optional script arguments]

Can you tell me what is happening?

Thanks,

Aditya

  • Hi Aditya,

    There were some updates made to the dss.bat file in CCS 10.3.0. But it should not have broken existing scripts. Can you share your *.js file? You can start a private E2E conversation with me if you do not wish to share publicly

    Thanks

    ki 

  • Hi Ki,

    Here is the script I am using. You have to rename this as .js after downloading at your end.

    runProgram_generic.txt
    /*******************************************************************
     * This sample script loads and runs a specified program on a 
     * specified target. 
     *
     * Usages:
     *   dss runProgram.js myTargetConfig.ccxml myProgramFile.out
     *   dss runProgram.js myTargetConfig.ccxml myProgramFile.out <BoardName>
     *   dss runProgram.js myTargetConfig.ccxml myProgramFile.out <BoardName> <CPUName>
     *
     * Requirement:
     *   <INSTALL DIR>\ccsv4\scripting\bin must be in your system path.
     *
     * You can copy and modify this script to suit your needs.
     *******************************************************************
     * Copyright 2010-2015 The MathWorks, Inc.
     *******************************************************************/
    
    // Import the DSS packages into the namespace;
    importPackage(Packages.com.ti.debug.engine.scripting);
    importPackage(Packages.com.ti.ccstudio.scripting.environment);
    importPackage(Packages.java.lang);
    
    // Define parameters ----------------------------
    
    var targetConfig;           // (user input) target configuration file
    var programName;            // (user input) program to load
    var boardName;              // (user input) board to use (optional) 
    var cpuName;                // (user input) CPU to use (optional) 
    
    var waitForHalt = 0;        // wait for program to halt before exiting
    
    var enableLogging = 0;              // enable logging
    var logFile = "RunProgramLog.xml";  // file where trace info is stored
    
    // Get the input parameters ---------------------
    var input = getArgs();
    programName  = input.programName;
    targetConfig = input.targetConfig;
    boardName    = input.boardName;
    cpuName      = input.cpuName;
    
    // Create/configure scripting object -------------
    
    // Create the scripting environment object
    var script = ScriptingEnvironment.instance();
    
    // Set the time out to 180 seconds
    // (comment this if you want to wait indefinitely)
    script.setScriptTimeout(180000);
    
    // Set up logging -------------------------------
    
    if (enableLogging) {
        // Create a log file in the current directory to log script execution
        script.traceBegin(logFile, "DefaultStylesheet.xsl");
        // Log everything
        script.traceSetConsoleLevel(TraceLevel.ALL);
        script.traceSetFileLevel(TraceLevel.ALL);
    }
    
    // Set up the debug session ----------------------
    
    print("\n*** Starting debug session...");
    
    // Get the Debug Server
    debugServer = script.getServer("DebugServer.1");
    debugServer.setConfig(targetConfig);
    
    // Start a Debug Session
    try {
        debugSession = debugServer.openSession(boardName, cpuName);
    }
    catch (ex) {
        print("*** Cannot create a valid debug session for Board/CPU=" + boardName + "/" + cpuName + ".\n" + 
              "    Make sure this matches only one board and one CPU.\n" + 
              "    Exiting...\n");
        exitScript();
    }
    print("*** Debug Session Name: " + debugSession.getName());
    print("*** Board Name: " + debugSession.getBoardName());
    print("*** CPU Name: " + debugSession.getCPUName());
    
    // Connect to the target -------------------------
    try {
        print("\n*** Connecting to target...")
        debugSession.target.connect();
    } 
    catch (ex) {
        // ignore if connect() fails - it may not be supported    
    }
    
    // Reset the target -------------------------------
    debugSession.target.reset();
    
    // Load the program -------------------------------
    print("\n*** Loading the program to the target...")
    debugSession.memory.loadProgram(programName);
    
    // Restart the program ----------------------------
    debugSession.target.restart();
    
    // Run the program --------------------------------
    
    // runAsynch() returns control immediately - it does not wait for program to halt
    debugSession.target.runAsynch();
    
    if (debugSession.target.isHalted()) {
        print("\n*** Program failed to run. Exiting...");
        exitScript();
    }
    else {
        print("*** Program is running.");
    }
    
    // Wait for the program to halt -------------------
    
    if (waitForHalt) {
        print("\n*** Waiting for program to halt...");
    
        // Wait for the program to halt
        debugSession.target.waitForHalt();
    
        if (debugSession.target.isHalted()) {
            print("\n*** Program is now halted.");
        }
    }
    
    // Disconnect from target --------------------------
    
    try {
        print("\n*** Disconnecting from target...");
        debugSession.target.disconnect();
    } 
    catch (ex) {
        // ignore if disconnect() fails - it may not be supported    
    }
    
    // All done -----------------------------
    
    print("\n*** Terminating debug session...");
    debugSession.terminate();
    debugServer.stop();
    
    print("\n*** LOAD & RUN DONE.");
    exitScript();
    
    /**************************************
     * Get arguments from the command-line. 
     **************************************/
    function getArgs()
    {
        var args = {};
        var arguments = this.arguments;
    
        if ((arguments.length<2) && (arguments.length>4))
        {
    		print(
                "ERROR: You did not specify the correct number of arguments.\n" + 
                "Usage: dss runProgram.js <targetConfigurationFile> <programFile>\n" +        
                "Usage: dss runProgram.js <targetConfigurationFile> <programFile> <boardName>\n" +
                "Usage: dss runProgram.js <targetConfigurationFile> <programFile> <boardName> <cpuName>\n"); 
            delete args;
            java.lang.System.exit(0);
    	}
        // Required inputs
        args.targetConfig = arguments[0];
        args.programName  = arguments[1];
    
        print("\n*** User inputs: ");
        print("    Target Configuration: " + args.targetConfig);
        print("    Program Name: " + args.programName);
    
        if (arguments.length >= 3) {
            args.boardName = arguments[2];
            print("    Board Name: " + args.boardName);
        }
        else {
            args.boardName = "*";  // first board
            print("    Board Name: unspecified (connect to first board)");
        }
        if (arguments.length == 4) {
            args.cpuName = arguments[3];
            print("    CPU Name: " + args.cpuName);
        }
        else {
            args.cpuName = "*";  // first CPU on first board
            print("    CPU Name: unspecified (connect to first CPU)");
        }
        return args;
    }
    
    /**************************************
     * Exit the script
     **************************************/
    function exitScript()
    {
        if (enableLogging)
        {
            script.traceSetConsoleLevel(TraceLevel.INFO); 
            script.traceEnd(); // stop logging
        }
        java.lang.System.exit(0);
    }

    You have to run the following command

    C:\ti\ccs1030\ccs\ccs_base\SCRIPT~1/bin/dss.bat <scriptPath>/runProgram_generic.js <CXMLFilePath>/F280025C.ccxml "<executablePath>/F28002~1.OUT" "*" C28xx_CPU1 "TI_F28002x" "*"

    Thanks,

    Aditya

  • Thank you for the script. There appears to be two bugs with the dss.bat in CCs 10.3.0. Well, one is a bug while the other looks like a limitation. As a workaround, I would suggest using the dss.bat from CCS 10.1.0 with CCS 10.3.0 (you can replace the dss.bat in 10.3.0 with the one from CCS 10.1.0 - they are compatible). 

    Thanks

    ki

  • I filed a bug for the the issues I mentioned above. Tracking link: https://sir.ext.ti.com/jira/browse/EXT_EP-10344

    Thanks

    ki

  • The attached update should resolve both issues.

    dss.bat
    @echo off
    REM *************************************************************************
    REM This script is used to run JavaScript-based DSS scripts.
    REM
    REM If eclipsec.exe is present, it will use the headless script launcher
    REM to run the script
    REM
    REM Otherwise, it does this by setting up the necessary environment and invoking the
    REM Rhino Javascript engine.
    REM
    REM Usage: dss [-dss.debug] [-dss.workspace WORKPLACE_FOLDER] DSS_JAVASCRIPT_FILE  [optional script arguments]
    REM
    REM *************************************************************************
    
    setlocal ENABLEDELAYEDEXPANSION
    
    set DEBUGSERVER=%~dp0..\..\DebugServer
    
    if not exist "!DEBUGSERVER!\..\..\eclipse\eclipsec.exe" (
    	REM if eclipsec.exe is not present, use the old way of launching the script 
    	goto LAUNCH_DSS_SCRIPT
    )
    
    REM Read the command line args looking for dss.debug or dss.workspace.
    set WORKSPACE=-data @user.home/workspace
    set OTHERARGS=
    set WORKSPACE_NEEDED=0
    
    :readargs
    REM A goto loop needs to be used here to prevent wildcard expansion. For loops always expand wildcards.
    if "%~1" neq "" (
    	if !WORKSPACE_NEEDED! EQU 1 (
    		set WORKSPACE=-data "%~1"
    		set WORKSPACE_NEEDED=0
    	) else if "%~1" == "-dss.debug" (
    		set DEBUG_FLAG=-dss.debug
    	) else if "%~1"=="-dss.workspace" (
    		set WORKSPACE_NEEDED=1
    	) else (
    		set OTHERARGS=!OTHERARGS! "%~1"
    	)
    	shift /1
    	goto :readargs
    )
    
    Rem We should have matched everything but the script and optional script args. If not, there's an error.
    if "%OTHERARGS%" EQU "" (
    	echo Usage: dss [-dss.debug] [-dss.workspace WORKPLACE_FOLDER] DSS_JAVASCRIPT_FILE  [optional script arguments]
    	goto THEEND
    )
    
    REM use the headless script launcher
    :LAUNCH_IDE_SCRIPT
    !DEBUGSERVER!\..\..\eclipse\eclipsec.exe -nosplash -application com.ti.ccstudio.apps.runScript -product com.ti.ccstudio.branding.product %DEBUG_FLAG% -dss.rhinoArgs %WORKSPACE% "%OTHERARGS%"
    
    goto THEEND
    
    :LAUNCH_DSS_SCRIPT
    
    REM Path to Rhino JAR File
    set RHINO_JAR="!DEBUGSERVER!\packages\ti\dss\java\js.jar"
    
    REM Path to DVT Scripting JAR File
    set DVT_SCRIPTING_JAR="!DEBUGSERVER!\..\dvt\scripting\dvt_scripting.jar"
    
    REM Path to DebugServer JAR File
    set SCRIPTING_JARS="!DEBUGSERVER!\packages\ti\dss\java\dss.jar"
    
    REM If this is CCS (rather than stand-alone DSS) also add Eclipse's Equinox Launcher JAR to to the classpath
    REM (need to modify to match the version of the JAR of the current version in Eclipse
    if exist "!DEBUGSERVER!\..\..\eclipse\plugins\org.eclipse.equinox.launcher_1.2.0.v20110502.jar" (
    	set SCRIPTING_JARS=!SCRIPTING_JARS!;"!DEBUGSERVER!\..\..\eclipse\plugins\org.eclipse.equinox.launcher_1.2.0.v20110502.jar"
    )
    
    REM Name of Rhino Shell Java Application
    set RHINO_SHELL=org.mozilla.javascript.tools.shell.Main
    
    REM Name of Rhino Debugger Java Application
    set RHINO_DEBUGGER=org.mozilla.javascript.tools.debugger.Main
    
    REM add path to Windows 32-bit on Windows 64-bit (WOW64) folder for 64bit Windows to use the 32bit applications.
    if exist "!SYSTEMROOT!\SysWOW64\" set PATH=!SYSTEMROOT!\SysWOW64\;!PATH!
     
    :SETUP_JRE_PATH
    REM If the user chose to install the JRE with this DSS install - use that JRE. 
    if exist "!DEBUGSERVER!\..\jre" (
    	set JAVA_HOME=!DEBUGSERVER!\..\jre
    	set PATH=!DEBUGSERVER!\..\jre\bin;!PATH!
    	goto LAUNCH_SCRIPT
    )
    
    REM If this CCS (rather than stand-alone DSS) the installed jre is in \eclipse\jre
    if exist "!DEBUGSERVER!\..\..\eclipse\jre" (
    	set JAVA_HOME=!DEBUGSERVER!\..\..\eclipse\jre
    	set PATH=!DEBUGSERVER!\..\..\eclipse\jre\bin;!PATH!
    	goto LAUNCH_SCRIPT
    )
    
    REM Launch Rhino script engine.  Import the scripting package.
    :LAUNCH_SCRIPT
    java.exe -Xms40m -Xmx384m -cp !RHINO_JAR!;!SCRIPTING_JARS!;!DVT_SCRIPTING_JAR! !RHINO_SHELL! %1 %2 %3 %4 %5 %6 %7 %8 %9
    
    :THEEND
    endlocal