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.

TCL Scripting Support for CCS V5.2

Other Parts Discussed in Thread: CCSTUDIO

Hi all,

Plz tell me whether  CCS V5.2  supports TCL Scripting, if yes then plz guide the procedure.

Regards,

Umesh

  • Umesh,

    The scripting solution for CCS is called Debug Server Scripting.  There is more information here: http://processors.wiki.ti.com/index.php/Debug_Server_Scripting

    The API is JAVA and the default supported language is JavaScript.  However you can use other languages what can interface with JAVA.  People have been able to use TCL by utilizing Jacl/Tclblend

    Regards,

    John

  • John 

    can you please guide us how TCl is utilizing JACL/Tclblend  for windows OS.Since we want to run TCL scripts in CCS V5.2 .

    Regards,

    Umesh

  • Umesh,

    Our examples and docs are for our supported language JavaScript.  We can put a short wiki article together but it may be a bit before it gets published.

    Attached is an example tcl script that uses some of our APIs.  This one is based on a very old version of DSS so some of the API and environment setup is different.  It was also done on Linux so tclblend_init variable would need to be adjusted.

    http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/81/2251.Memory.tcl

    Regards,

    John

  • John

    i am able to install Jacl/TCL Blend can guide me who it will be interface to CCS 5.2v so that i can run TCL scripts

    Regards,

    Umesh

  • Hi John,

    We are able to install Jacl/TclBlend.But we are facing the problem in these steps .We are getting errors for setting Environment which is there in 

    0285.Memory.tcl.Please guide us how to tackel it.
    
    
    Install Debug Server Scripting (note that you already have DSS via CCS)

     

    • Install Debug Server Scripting. The following steps will assume that DSS is installed in /opt/ti/dss1.1

     

    • Create a folder in your home directory called ti. Copy the device configuration file /opt/ti/dss1.1/SystemSetup.xml to your home directory ~/ti/SystemSetup.xml
      • If you've installed DSS into a folder other than /opt/ti/dss1.1 you will need to manually edit ~/ti/SystemSetup.xml and replace the path entries with your own

     

    • Create a Shell script that sets-up the correct Java classpaths and launches Tcl Blend:

     

        #! /bin/sh
    
        # DebugServer root directory - edit if necessary
        DEBUG_SERVER_ROOT=/opt/ti/dss1.1/DebugServer
    
        # Debug Server library paths - don't edit
        LD_LIBRARY_PATH=$DEBUG_SERVER_ROOT/bin/linux_ia32:$LD_LIBRARY_PATH
        LD_LIBRARY_PATH=$DEBUG_SERVER_ROOT/linux/components:$LD_LIBRARY_PATH
        LD_LIBRARY_PATH=$DEBUG_SERVER_ROOT/drivers:$LD_LIBRARY_PATH
        export LD_LIBRARY_PATH
    
        # Java class paths - don't edit
        CLASSPATH=$DEBUG_SERVER_ROOT/linux/sdk/lib/MozillaInterfaces.jar:$CLASSPATH
        CLASSPATH=$DEBUG_SERVER_ROOT/scripting/lib/com.ti.ccstudio.scripting.environment_3.1.0.jar:$CLASSPATH
        CLASSPATH=$DEBUG_SERVER_ROOT/scripting/lib/com.ti.debug.engine_1.0.0.jar:$CLASSPATH
        export CLASSPATH
    
        tcl_dir=`pwd`
    
        # If tclblend was installed in a different folder - you'll need to edit this path
        exec /opt/tclblend/bin/jtclsh $tcl_dir/$1
    

     

    • Our Linux implementation of the Debug Server use XPCOM component technology from Mozilla. It is necessary to pass the full pathname to the XPCOM runtime folder to Java. This is done using Tcl by beginning each Tcl script with the following two lines:
      • set tclblend_init {-DXPCOM.RUNTIME=/opt/ti/dss1.1/DebugServer/linux}
      • package require java
    
    

    Language Idiosyncrasies

     

    • When calling ScriptingEnvironment.getServer() API, it's necessary to cast the returned server appropriately. This is done using [java::cast] method:
      • set debugServer [java::cast com.ti.debug.engine.scripting.DebugServer [$environment getServer "DebugServer.1"]]
    • In many Java and Javascript public fields are accesses using the . operator (i.e. myDebugSession.target.reset()). However TclBlend has a [java::field] method. You can either:

     

         set target [java::field $myDebugSession target]
         $target reset
    

    or

     

         [java::field $myDebugSession target] reset
    
    
    
    
    
    
    Here is the Shell file
    
    
    #! /bin/sh
    
    # DebugServer root directory - edit if necessary
    DEBUG_SERVER_ROOT=/opt/ti/dss1.1/DebugServer
    
    # Debug Server library paths - don't edit
    LD_LIBRARY_PATH=$DEBUG_SERVER_ROOT/bin/linux_ia32:$LD_LIBRARY_PATH
    LD_LIBRARY_PATH=$DEBUG_SERVER_ROOT/linux/components:$LD_LIBRARY_PATH
    LD_LIBRARY_PATH=$DEBUG_SERVER_ROOT/drivers:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH
    
    # Java class paths - don't edit
    CLASSPATH=$DEBUG_SERVER_ROOT/linux/sdk/lib/MozillaInterfaces.jar:$CLASSPATH
    CLASSPATH=$DEBUG_SERVER_ROOT/scripting/lib/com.ti.ccstudio.scripting.environment_3.1.0.jar:$CLASSPATH
    CLASSPATH=$DEBUG_SERVER_ROOT/scripting/lib/com.ti.debug.engine_1.0.0.jar:$CLASSPATH
    export CLASSPATH
    
    tcl_dir=`pwd`
    
    # If tclblend was installed in a different folder - you'll need to edit this path
    exec /opt/tclblend/bin/jtclsh $tcl_dir/$1
    
    
    
    
    Example Script (may need an update as the API could have changed)
    0285.Memory.tcl
  • hi John,

    We are also facing the environment setting issue with 2251.Memory.tcl (same that u shared in above mail).Error log is as given below,

    cannot import class "com.ti.ccstudio.scripting.environment.ScriptingEnvironment"
    , it does not exist

    Please guide us to set the path for importing java packages such as 

    java::import com.ti.ccstudio.scripting.environment.ScriptingEnvironment
    java::import com.ti.ccstudio.scripting.environment.TraceLevel

    Waiting for your reply

    Regards,

    Umesh 

  • Umesh,

    For JavaScript people run the dss.bat file and pass their .js file to it.  In the old TCL example we posted it has a sample shell script that does much of the same for Linux.  http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/113625.aspx

    I would suggest taking a look at the environment variables you are setting up to see if they are pointing to the correct locations.  If you want to check against the dss.bat or even use it as a starting point it is located in \ccsv5\ccs_base\scripting\bin

    Unfortunately I do not have any personal experience using TCL with DSS.

    Regards,

    John

  • Hi John,

    As you know we are trying to create  test automation  tool using TCL scripting with CCS v 5.2 (DSS), But we are facing issues with  setting Environment for TCL.

    We are facing the below error even after setting the PATHs and CLASSPATHs (changing with respect to windows) as mentioned in the Linux example.

    cannot import class "com.ti.ccstudio.scripting.environment.ScriptingEnvironment"
    , it does not exist

    Can you guide us  where exactly the above package is present and this package is necessary for Java script also. 

    Please share us any relevant documents if you have (even if the documents are for previous versions of CCS) and also introduce us to the person who really worked with TCL automation with CCS v5 or previous versions.

    Thanks and Regards,

    Umesh.