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 Scripts in Code Composer Studio



Hi,

Can anyone let me know how we can wrtie and execute TCL Scripts in TI Code Composer Studio.

Thanks,

Venky

  • Venky,

    Code Composer Studio has a scripting interface called Debug Server Scripting or DSS.  The API for this is Java so the supported scripting language is JavaScript.  However you could use another language if you can find a bridge layer to Java.  For TCL I believe the layer you would want to use is called TCLBlend/Jacl.  There is more information available here: http://tcljava.sourceforge.net/docs/website/index.html

     

    Regards,

    John

  • Thanks John,

    What Specific updates are required, to be updated for DSS in Code Composer Studio.Analysed the "DSS.bat" file, and default it is specifed for Rhino.

    Tried to updated for TCLBlend using the similar way,  but that does not work. Do the *.jar files provided by TI, is specifcally meant for Rhino, So i am not sure what other *.jar files will be required for TCLBlend, as the Source is not provided.

    Please let me know the updated required for TCLBlend.

    Thanks,

    Venky

  • Venky,

    The best I can do is that I have found some old instructions that were written for an old version of DSS on Linux.  Hopefully it gives you something to start with.

    Regards,

    John

     

     Build and Install Tcl/Tcl Blend

    Tcl Blend depends on Tcl and the Tcl Threads extension. Most Linux systems ship with Tcl installed by default, but Tcl thread support is not typically enabled. Tcl Blend requires a version of Tcl that is compiled with Thread support, so you will need to compile Tcl, the Tcl Thread extension, and Tcl Blend (luckily you only need to do this once - then it's sufficient to copy these built binaries to other machines).

     

     

    • The following steps assume that:
      • You have created a temp directory /tmp/tclblend, that the archives have been saved in this directory
      • That Tcl Blend will be installed into /opt/tclblend
      • That the JDK install is located in /opt/java/jdk1.5.0_09

     

        cd /tmp/tclblend
    
        tar -xzvf tcl8.4.14-src.tar.gz
        tar -xzvf thread2.6.5.tar.gz
        tar -xzvf tclBlend1.4.0.tar.gz
    
        mkdir build_tcl
        mkdir build_thread
        mkdir build_tclblend
    
        cd build_tcl
        ../tcl8.4.14/unix/configure --prefix=/opt/tclblend --enable-threads
        make
        make install
        cd ..
    
        cd build_thread
        ../thread2.6.5/configure --prefix=/opt/tclblend --enable-threads --with-tcl=/tmp/tclblend/build_tcl
        make
        make install
        cd ..
    
        cd build_tclblend
        ../tclBlend1.4.0/configure --prefix=/opt/tclblend --with-tcl=/tmp/tclblend/build_tcl --with-thread=/tmp/tclblend/build_thread --with-jdk=/opt/java/jdk1.5.0_09
        make
        make install
    
    

    At this point, Tcl, the Thread extension, and Tcl Blend will have been installed into /opt/tclblend. The install process creates a startup script that should be used to run Tcl Blend. This script is named jtclsh, it would be installed into /opt/tclblend/bin/jtclsh by the example above.

     

        /opt/tclblend/bin/jtclsh
        % package require java
        1.4.0
        % exit
    
    
    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)
    
    
    http://e2e.ti.com/cfs-file.ashx/__key/CommunityServer-Discussions-Components-Files/81/0285.Memory.tcl
    
    

     

  • Hi John,

    The instruction provided gives information how to build TCLBlend for Linux and configuration of DSS for linux enviornment.So there is no information how to interface TCLBlend  with CSS using DSS.

    It would Great, if you have the instrutions for interfacing TCLBlend with CCS for Windows.

    Thanks,

    Venky

  • Venky,

    I don't have any instructions for Windows.  

    Regards,

    John

     

  • Thanks John,

    Thanks,

    Venky

  • Hi John,

    I have couple of Question.

    1. Do you have any Script for launching the TCLBlend "shell" or "debugger", if so can you share it for linux.

    2. Can You Please share us the content of "dss.bat", "trace_dss.bat" and "dss.sh" files for TCLBlend interafce with CCS.

    Thanks,

    Venky