NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Code Composer Watch Window: Using a Script to Populate

From Texas Instruments Wiki
Jump to: navigation, search

Introduction[edit]

In Code Composer Studio 3.3 gel files were often used to easily populate the watch window with a defined set of variables. In Code Composer Studio 4 this is not possible by using gel files. In general, CCS 4 uses a workspace to save and restore a particular debug environment.

It may be desirable, however, to provide a simple script that will populate the watch window. This is helpful for collections of examples where it is not practical to supply a workspace that corresponds to each example.

This article explains how a JavaScript file can be used to populate the watch window. This has the advantage of being small and easily shared with other developers.

Note: CCS 4 and CCS 5[edit]

Code Composer Studio 4 uses java 1.4 while CCS 5.x uses java 1.6. The javascript parser is different between these two versions. In particular, the later java version enforces stricter syntax requirement. For this reason some scripts that worked under CCS 4 may fail under CCS 5.

Please refer http://en.wikipedia.org/wiki/JavaScript_syntax#Functionse for javascript syntax for function calls.

Step 1: Create the JavaScript script file[edit]

JavaScript can be used to quickly add a defined set of variables to the Code Composer Studio 4 watch window.

This example script uses the expAdd JavaScript function to add structures and variables to the watch window. The format of the display of each variable can also be specified by using getHex, getDecimal, getBinary, getFloat, getNatural, and getQValue.


<syntaxhighlight lang='javascript'> // // CCS V5 // my_watch.js // // expAdd ("CpuTimer0" ); expAdd ("CpuTimer1" ); expAdd ("CpuTimer2" ); expAdd ("CpuTimer1.InterruptCount" ); expAdd ("CpuTimer1.InterruptCount" ); expAdd ("CpuTimer1.InterruptCount" ); </syntaxhighlight>


Note: In CCS V4 the syntax was somewhat relaxed and the following script would have worked. Notice in the CCS 5 version, the ()'s around each function call and the ; after each function. Also notice that you can no longer set the view format programatically [1]


<syntaxhighlight lang='javascript'> // // CCS V4 // my_watch.js // // expAdd "CpuTimer0" getNatural() expAdd "CpuTimer1" getNatural() expAdd "CpuTimer2" getNatural() expAdd "CpuTimer1.InterruptCount" getDecimal() expAdd "CpuTimer1.InterruptCount" getHex() expAdd "CpuTimer1.InterruptCount" getNatural() </syntaxhighlight>

Step 2: Open the Code Composer Studio scripting console[edit]

In Code Composer Studio, open the scripting console by using the view->scripting console menu

Step 3: Run the script[edit]

Click on the "Open Command File" at the top right of the scripting console.


Script.jpg


Navigate to the script you wrote in step 1 and select "open" The script will now run and populate the watch window.


Script001.jpg


The result is the following watch window.


Script002.jpg


Other commands[edit]

In the scripting console window you can type commands as well.

  • To get help on a particular command type help and the command: js:> help expAdd
  • To get a list of all commands type help followed by a tab.


References[edit]

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Code Composer Watch Window: Using a Script to Populate here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Code Composer Watch Window: Using a Script to Populate here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Code Composer Watch Window: Using a Script to Populate here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Code Composer Watch Window: Using a Script to Populate here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Code Composer Watch Window: Using a Script to Populate here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Code Composer Watch Window: Using a Script to Populate here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Code Composer Watch Window: Using a Script to Populate here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Code Composer Watch Window: Using a Script to Populate here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Code Composer Watch Window: Using a Script to Populate here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity