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.

Running CCS from a Debug Server Script - Class not found

Other Parts Discussed in Thread: CCSTUDIO

I have many scripts that I run for unit tests from Matlab (rather than javascript).

When I try to start CCS in these scripts it gives me the following with a  java.lang.ClassNotFoundException

getServer: Getting definition for: CCSServer.1
getServer: Constructing server
getServer: RETURN com.ti.ccstudio.scripting.CCSServer@515783
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

Is there a package that I need to import or dir I need to add to the javapath so that this class will be found? I can't find a file in the install with a similar name. Here is the Matlab code I am using. The CCS session stuff is what is new and not working.

        javaaddpath([ ds_dir 'packages\ti\dss\java\dss.jar' ]);
        
        import com.ti.debug.engine.scripting.*;
        import com.ti.ccstudio.scripting.environment.*;
        
        import com.ti.ccstudio.apps.scripting.*;
        import com.ti.ccstudio.apps.scripting.ScriptUtils.*;
        
        script = ScriptingEnvironment.instance();
        
        script.traceBegin('CCSSession.xml', 'DefaultStylesheet.xsl')
        script.traceSetConsoleLevel(TraceLevel.ALL)
//%         script.traceSetFileLevel(TraceLevel.ALL)
        
        ccsServer = script.getServer('CCSServer.1');
        ccsSession = ccsServer.openSession('.*');
        
        this.debug_server = script.getServer('DebugServer.1');
       
        this.debug_server.setConfig(target_config_loc);
        this.debug_session = this.debug_server.openSession('.*');

        //% Load the program
        this.debug_session.memory.loadProgram(program_loc);

Here is the javascript example included with the install for bringing up CCS from a script:

// 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()

script.traceBegin("CCSSession.xml", "DefaultStylesheet.xsl")

// Log everything
script.traceSetConsoleLevel(TraceLevel.ALL)
script.traceSetFileLevel(TraceLevel.ALL)

// Start up CCS
ccsServer = script.getServer("CCSServer.1")
ccsSession = ccsServer.openSession(".*")

Does anyone know where this missing class is or how it is found by the Javascript but not the Matlab script?

Thank you

Chris

---------------------------EDIT----------------------------

After adding:

javaaddpath([ 'C:\ti5\ccsv5\eclipse\plugins\com.ti.ccstudio.apps_5.5.0.201308270800.jar' ]);

WARNING: CCSServer.openSession() failed.  DSS was unable to launch Code Composer Studio, however script execution will continue. java.lang.reflect.InvocationTargetException: null 

I think this is where the class is defined.

---------------------------EDIT----------------------------

I believe that this link about Python/Jython for DSS applies to Matlab. It is essentially a scripting language with a JRE so java classes can be imported and instantiated:

http://processors.wiki.ti.com/index.php/Python_Scripting_with_DSS#Setting_up_the_Environment

It says "any language that supports importing and using Java classes can be used with DSS". I think that any help on Jython would also apply to Matlab. 

New question: Is it possible to run the CCS session from a DSS Jython script? Has anyone got this working?

It does not seem that the imported jars in the Jython DSS wiki page are sufficient to load CCS.

Thank you for any answers you can share with me. We have a whole unit test framework based on DSS in Matlab and this would make working with it so much more powerful. 

  • Hi Chris,

    If you are going to run DSS scripts without using the dss.bat file, it is important that you look at what that batch file does so you can set up your environment accordingly. Most DSS documentation assumes you are running your scripts via the batch file. If you can't use the dss.bat file because you are not using javascript, then you need to set up the environment yourself (like that link for setting up the environment when using jython). Same goes for if you are using javascript but don't want to use the dss.bat file for whatever reason.

    In older version of CCS, it was possible to set up your classpaths with the necessary jar files to be able to not only run DSS scripts, but also get the CCS Server. This has changed recently. You now need to launch the script using the headless script launcher. You can still launch your DSS script the old way but the one thing you do lose is the ability to launch CCS from DSS. Hence I recommend you launch the script using the headless script launcher like the batch file does.

    c0l0jar0 said:
    It says "any language that supports importing and using Java classes can be used with DSS"

    Remember that trying to get the CCS Server to launch the CCS GUI is NOT DSS. DSS is scripting access to the debug server without the GUI.

    Thanks

    ki

  • Ki-Soo Lee said:
    In older version of CCS, it was possible to set up your classpaths with the necessary jar files to be able to not only run DSS scripts, but also get the CCS Server. This has changed recently. You now need to launch the script using the headless script launcher. You can still launch your DSS script the old way but the one thing you do lose is the ability to launch CCS from DSS. Hence I recommend you launch the script using the headless script launcher like the batch file does.

    1. Which older versions did not use the headless launcher but could still run the CCS server?
    2. The headless launcher only works for javascripts correct?
    3. So any language other than javascript, in recent CCS/DSS versions, can not launch CCS from a DSS script?
     
    BTW, I already have class paths set up and everything works great in Matlab for pure DSS scripting (v5.3/5.5). I have close to a hundred scripts that use it for unit-testing C++ DSP code, mostly algorithms.
  • c0l0jar0 said:
    • Which older versions did not use the headless launcher but could still run the CCS server?

    Up to CCSv5.2

    c0l0jar0 said:
    The headless launcher only works for javascripts correct?

    Yes

    c0l0jar0 said:
    So any language other than javascript, in recent CCS/DSS versions, can not launch CCS from a DSS script?

    It may be possible. But it is not something that we support.

    c0l0jar0 said:
    BTW, I already have class paths set up and everything works great in Matlab for pure DSS scripting (v5.3/5.5).

    Yes you can still set up the classpaths as you always did in older versions and DSS will work fine with other languages too. The only thing that you would really lose is launching CCS from DSS.