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.

Scripting FAQ

From Texas Instruments Wiki
Jump to: navigation, search

Scripting Frequently Asked Questions


CCStudio Scripting Utility

Q: Does the CCStudio Scripting Utility support other COM based scripting languages?

Yes. While the current version of the Scripting Utility officially supports VBA from the standpoint of testing and documentation, any COM based scripting language, such as JavaScript, may be used.

Q: Is the behavior of TargetEvalExpression() synchronous or asynchronous?

All the CCStudio Scripting API’s, including TargetEvalExpression(), are synchronous in behavior. TargetEvalExpression() waits for notification that the GEL function was evaluated then returns. However it is important to understand the GEL call being passed to TargetEvalExpression() because for built-in GEL calls that have asynchronous behavior, this notification returns right away whether the actual action is fully completed or not (such as GEL_Load() ). For synchronous GEL calls and custom GEL functions/actions, TargetEvalExpression() will wait until the call (and associated action) has been completed since notification will come then. For more understanding on the behavior of GEL and a list of asynchronous built-in GEL calls, please refer to the FAQ: Is the behavior of GEL synchronous or asynchronous?

Q: How come CCStudio Scripting gives an error when I try to use the built-in enumerators in my script?

When you use a scripting language that supports early binding, your code can refer to the built-in enumerators provided by CCS Scripting. If you use a scripting language that supports late binding, you must define these constants in your code by looking up the enumerator values in the documentation.

Perl and Visual Basic (both VB and VBA) are examples of scripting languages that support early binding (VB and VBA supports both early and late binding). Windows Script Host JScript and VBScript are examples of scripting languages that only support late binding.

For more information regarding the differences between VB, VBA and VBScript, please refer to this FAQ on the MSDN Library: http://msdn.microsoft.com/isv/technology/vba/faq/default.aspx

Q: How can I make CCStudio Scripting use a specific CCStudio installation on a machine with multiple installations of CCStudio?

CCStudio Scripting will use the last CCStudio installation that ran on the machine. If there is only one installation of CCStudio, then it will always run the same installation. To make sure CCStudio Scripting calls the correct installation of CCStudio, manually open and close the installation of CCStudio that you would like to script.

Q: My computer has multiple versions of CCStudio installed. How can I specify which installation gets launched by the CCStudio Scripting Utility?

For computers with multiple installations of CCStudio, the Scripting Utility will launch the version of CCStudio that was run last. There is no explicit way to have the Scripting Utility launch a particular installation. To ensure that a desired installation of CCStudio is launched, launch that CCStudio version and close it before running the scripts.

Versions 1.4 or greater of the Scripting Utility can connect to a running instance of CCStudio. One can have the script or batch file launch the desired installation of CCStudio (run the ‘<Install Dir>\cc\bin\cc_app.exe’ for the desired installation) and then have the Scripting utility then connect to the currently running instance of CCStudio (with the same CCSOpen() / CCSOpenNamed() API).

Q: Why do my Perl scripts fail to work with the CCStudio Scripting Utility? I am using the latest version of the Scripting Utility.

A common cause for Perl scripts to fail with the CCStudio Scripting Utility is that the environment is not configured correctly. Three places to check are:

  • Make sure the version of ActivePerl installed is the same version that was selected when installing the CCStudio Scripting Utility (5.6 or 5.8)
  • Make sure the paths in <CCStudio Install>\bin\utilities\ccs_scripting\CCS_Scripting_Perl.bat are correct and that the batch file is executed before running the Perl scripts
  • Make sure that if you have multiple versions of Perl installed (ex. ActivePerl and Perl via Cygwin) that when the Perl interpreter is called, that the correct version of Perl that will work with the Scripting Utility is used. (do a ‘perl –v’ from the command line to confirm this).
Q: Why does the CCS Script running through a Perl or a Visual Basic script look to be hung when the target is running?

The Perl Script or Visual Basic Script looks to be hung when it tries to read or write to the DSP memory location. The CCS cannot read or write to a memory location when the DSP is running and so the scripting API cannot do the same. The API script which tries to read/write to a memory location would not return unless the target is halted through the break point or manually halted through the CCS. One solution for this is to set a break point through the script, read/write to the memory and run the target again.

Q: Is there any way to script the Component Manager?

The CCStudio Component Manager can be used to switch between different installations of the Code Generation Tools or DSP/BIOS that is used by CCStudio when building a project. Unfortunately the Component Manager cannot be automated by CCScripting. However, you can automate what the Component Manager basically does: modify the registry to point a CCStudio version to the version of cgtools/bios that you wish to use.

Example for automating switching between two different installations of the codegen tools for C64x (C6000 6.1.0A3 and C6000 6.0.8):

Open up the registry and browse to:

My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Texas Instruments

And select an installation of CCStudio (ex. CCS_C:|CCStudio_v3.3|). Under the CCStudio entry, select a Device (ex. TMS320C64xx) and export the registry key for 'Build Tools'. Save it to a *.reg file (ex. C6000cgtools610A3.reg).

CCS FAQ componentmgr.PNG

Next use Component Manager to select the other cgtools installation to be used with C64x. Once this is done, repeat the steps above, except make sure you export the registry key to a *.reg file of a different name (ex. C6000cgtools608.reg).

Once you have all your reg files you can just run the one you need (just type in the *.reg file name in the command line) to configure CCStudio to use for a particular build. This can be automated in a batch file. To silently update the registry without any dialogs popping up use "regsvr32 regfile.reg -s".


Debug Server Scripting

Q: Where do I get DSS?

DSS is currently available as part of the CCStudio v4 release and can be downloaded from the CCStudio v4 main page.

Note - DSS is truly independent of the CCS GUI (unlike CCScripting) - the CCSv4 release is simply the mechanism by which you obtain the DSS product.

Q: Which scripting languages are supported?

Officially we are supporing Java and Javascript as the prefered scripting solutions for the debug server. Perl examples are also available. However we recognize that there are many third-party solutions available to interface Java with TCL (tclblend) and Python (Jython). These solutions will be investigated on a case-by-case basis.

Q: Where are the DSS help files?

You can find the DSS Release notes and API Reference Guide under <install dir>\scripting\docs

You can bring up the API Reference Guide by opening docs\API\index.html in your Internet browser. This API guide is automatically generated via javadoc so it should always be up to date with respect to the latest source.

Q: What about existing GEL and CommandWindow? functionality?

Several GEL commands (such as GEL_MapAdd, etc.) already have equivalent commands in the scripting API set. Others are supported through the expression.evaluate() method. CommandWindow? functions are more complicated as the CCS CommandWindow? plugin has its own parser and execution engine that is not implemented in debug server. If there is a method that you require but is not available please log an item in ClearQuest?.

Q: What is Rhino?

Rhino is an open-source implementation of Javascript written in Java. Rhino also provides functionality to allow direct script access of Java classes.

Q: : I'm trying to run a script using the Rhino shell from the command line and I'm getting the error "uncaught JavaScript runtime exception: ReferenceError: 'ScriptingEnvironment' is not defined." What's wrong?
  • If your classpath is configured then perhaps the package import command in your Javascript file is incorrect. Make sure you have the following line near the top of your file.
importPackage(Packages.com.ti.debug.engine.scripting)

Note: Even though the package is called com.ti.ccstudio.debug.server.scripting don't forget the prefix Package. and do not wrap the package name in quotes or you'll get an error Function importPackage must be called with a package; had "Packages.com.ti.ccstudio.debug.server.scripting" instead.

  • On machines that have multiple JRE installed, make sure that JRE v1.5.0 is being referenced. This can be checked by invoking:
java -version

If the wrong JRE is being referenced, update the environment so the correct JRE (1.5.0) is referenced or explicitly call the java.exe in your 1.5.0 installation.

Q: Why are the generated log files XML?

We recognize that everyone will have slightly different logging needs. By producing standardized XML log files it is easy to transform XML using XSLT (XML StyLesheet Transforms) into any custom format (comma-delimited text, HTML, etc.).