Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

GUI Composer/DSS Scripts

From Texas Instruments Wiki
Jump to: navigation, search

Overview

Starting with Code Composer Studio version 6, GUI Composer allows GUI Controls (e.g. buttons) to invoke Debug Server Scripting (DSS) scripts. DSS commands provide access to debug type functionality allowing control of your target system. For example you could create actions that control CPU execution or reset the system. DSS commands that deal with accessing the target and controlling its execution are limited to GUI Composer applications that use JTAG for host <-> target communication.

Calling DSS scripts in GUI Composer

To execute the DSS scripts from the application you need to add DSS Script file named dsScript.js to your application. The functions in that script can be called from the application scripts by calling the API TI.DSS( functionName, parameter1, paramater2, …). This API can be invoked from anywhere within the GUI Composer application’s script provided that guiComposer.js is already included. For example there can be a Step button in the application and when user selects that button a step command will be issued to the target. GUI Composer Runtime provides a javascript execution environment for DSS scripts. Note the DSS javascript environment is different from the application’s javascript environment. That means the DSS script will not be able to access GUI objects, e.g. set some text in a text box widget. The scripts If you need more information on DSS or GUI Composer, please visit:

DSS: http://processors.wiki.ti.com/index.php/Debug_Server_Scripting

GUI Composer: http://processors.wiki.ti.com/index.php/Category:GUI_Composer

Example

To demo the feature let’s create a GUI composer application that issues source step command to the target when a button is clicked.

  • Open GUI Composer editor.
  • Create a new GUI Composer project.
  • Add a new javascript file from the GUI Composer Project view toolbar button. Name it dsScript.js.
  • Copy and paste the content bellow to the newly opened javascript editor:
   importPackage(Packages.com.ti.ccstudio.scripting.environment)
   function myStepOver( steps) {
       if(!$active_context_name) {
           throw "An active Debug Session is required for myStepOver()";
       }
       var debugServer = ScriptingEnvironment.instance().getServer('DebugServer.1');
       var session = debugServer.openSession($active_context_name);
       var i;
       for( i = 0; i < steps; ++i) {
           session.target.sourceStep.over();
       }
   }
  • Save the javascript editor.
  • Drag and drop a button from the Pallet to the work area of the editor.
  • Select the button in the work area, then click on the Events tab on the right side of the editor.
  • In the onclick: filed enter TI.DSS( 'myStepOver' , 3)
  • Save the application by pressing the Save button at the top left of the GUI Composer window.
  • Suspend the target if it is running.
  • Preview the application by pressing the Preview button at the top right of the GUI Composer window.
  • Click the button – note how the target executes three source steps.


Notes

The use of the global variable $active_context_name in dsScript.js. When the script is invoked it will contain the name of the currently selected CPU in the debug view. If there is no debug session it will be set to null. You can see from the code how this variable is passed as parameter to openSession.


There is no restriction that the script invokes commands only on the selected core. Calling openSession with different parameter than $active_context_name can be used to obtain access to the different CPUs of the system. Keep in mind that calling a session object that is not the initialized with the active context name will probably make the script specific for a given target configuration.