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.
Hi Guys,
When my colleague imports my project, he has to look for the necessary variables and then add it manually to the watch window. Is there any way to make it happen automatically when he imports and runs my program?
Prakash,
Yes, there is a way to perform several automated operations during the debug session. Several methods are described in this wiki page.
The process to add variables cannot be fully automated, given that a core must be connected and a program needs to be loaded so the routines are able to properly find the variable names. However the addition of variables can be simplified to a single click. A small walk through is the following:
- Open the Debug session you are working on.
- Open the scripting console view (menu View --> Scripting Console). This is useful to find the syntax of the command and test its parameters.
- The command to add an expression is called expAdd(). You can type its help to see the parameters:
scripting_console said:
js:> help expAdd
Description: Add an expression to the expression view
Syntax: expAdd(expression)
Arguments:
expression - the expression to add to the expression view
Description: Add an expression to the expression view with a given format
Syntax: expAdd(expression,format)
Arguments:
expression - the expression to add to the expression view
format - the display format that will be tried to use (if reasonable) when the value of expression is displayed This is an optional parameter. The format can be obtained from getHex, getDecimal, getBinary, getNatural, and getQValue.
- Create a new file (menu File --> Other --> General --> File) and store it into your project directory. Give it a .js extension.
- Open this file (sometimes you need to right click on it and select Open With --> Text Editor) then pass the commands to populate the variables, MMRs, expressions you want with a single mouse click. The example script below adds a menu entry named Show variables to the Scripts menu of the Debug session.
scripting_file said:
function load_vars()
{
expRemoveAll();
expAdd('REG_SYSTEM_MEM_VALID',getHex());
expAdd('saram_start',getNatural());
expAdd('count',getDecimal());
expAdd('return_code',getHex());
}
hotmenu.addJSFunction("Show variables","load_vars()");
- To use this newly created file go back to the scripting console and issue the command loadJSfile() with the last parameter as true (so it can be automatically loaded when the debug session starts).
loadJSFile("C:\Users\user\workspace_v6_2\my_proj\show_variables.js",true);
This method also allows to open other views such as graphs, etc.
graph_example said://Open the graphs
openAnalysisView('Dual Time','C:/Users/user/workspace_v6_2/my_proj/my_proj_graph.graphProp')
Some examples are bundled with controlSUITE projects.
Hope this helps,
Rafael