FAQs for Script Language PRACTICE
|Can I execute a PRACTICE script on a specific event e.g. program stop?|
You can use the command ON or GLOBALON for this. ON is suitable when there is still an active PRACTICE script controlling your test case. GLOBALON is suitable if you want a reaction on an event until you disable it again.
The general syntax is:
ON|GLOBALON <event> <action>Please refer to the description of the ON and GLOBALON commands respectively in the "General Commands Reference Guide O" and "General Commands Reference Guide G" for more information on the supported events and actions.
To disable the event handler use
ON|GLOBALON <event> inheritExamples:
1. Execute a PRACTICE script when the program execution is stopped:
GLOBALON PBREAK DO myscript.cmm2. Continue the PRACTICE script execution when an error happens:
ON ERROR CONTinue3. Execute the subroutine powerup_handler when target power is switched to on:
ON POWERUP GOSUB powerup_handler
|Can I set a breakpoint with a logical condition?|
The command Break.Set has an option /VarCONDition , which allows you to specify a condition under which the CPU stays stopped once it hits the corresponding breakpoint. (In the dialog for setting breakpoints you'll find also the field "Condition" for that, when you click on "advanced".)
Example: set a breakpoint on function MyFunc with the condition that the variable x==10 and y==11
Break.Set MyFunc /VarCONDition (x==10 && y==11)
As a result the CPU is stopped every time the function MyFunc is executed, but gets immediately restarted when condition "x==11 && y==11" is not met.
You can also specify a condition in the PRACTICE language by using the Break.Set option /CONDition instead of /VarCONDition
Break.Set MyFunc /CONDition (Register(R0)==0)
|How can I print the content of a TRACE32 window into a file?|
The commands PRinTer.FILE and WinPrint can be used to print a TRACE32 window into a file.
The /Append option of the PRinTer.FILE command can be used to append new data to the existing file e.g. in ASCII or XHTML. Without /Append , file contents are overwritten if the file already exists.
PRinTer.FILE output.txt /Append WinPrint.Trace.List WinPrint.Data.dump 0--0xfff PRinTer.FILE file01.html XHTML WinPrint.List.Mix func7--func17Please refer for more information to the "PowerView Command Reference"
|How to check the return value of a function in a PRACTICE script?|
Every function has usually a pseudo-variable called return . You can see that in window sYmbol.Browse.Var \\*\*\<myfunc>\* (where myfunc is the name of your function). Of any variable you can get its value with PRACTICE function Var.VALUE(<variable>).
So you get the return value of function myfunc() with
GO sYmbol.EXIT(myfunc) // go to return statement of myfunc PRINT Var.VALUE(return) // get the return valueIn case you would like to do a module test, then you can use the Var.set command and Var.VALUE(<varname>) PRACTICE function.
Example: to call the function int func3(int a, int b) with random arguments (e.g. 5 and 3) and get the return value, do the following:
Var.NEWLOCAL \x // create artificial variable on the PRACTICE stack Var.set \x=func3(5,3) // execute func3() with arguments 5 and 3 on your CPU PRINT Var.VALUE(\x) // get the return value
|How to put a breakpoint on a specific source code line from a TRACE32 PRACTICE script?|
You can use the following syntax to set e.g. a breakpoint at line 42 of the file myfile.c located under c:\t32\myproject\ :
Break.Set \"c:\t32\myproject\myfile.c"\42or simply:
|Is it possible to execute a PRACTICE script when a breakpoint is hit?|
You can set the breakpoint with: Break.Set <addr> /Program /CMD "DO myScript.cmm"
To continue the execution of the target program, add the command Go to the end of the called PRACTICE script.
The Break.Set command knows also an option /RESUME , but this is not suitable in this case, since it won't wait until the called PRACTICE script has finished.
|Is it possible to run an external program from within TRACE32 PowerView?|
Depending on what you actually want to do, one of the following commands should be suitable to run any external program or batch file:
|Is it possible to stop the program execution when a CPU register is written with a specific value?|
It is not possible to stop the program execution on a CPU register read or write since this is not supported by any processor on-chip debug implementations. It is only possible to set breakpoints on program execution or memory accesses (read/write). It is thus possible to set an on-chip breakpoint on an access to a memory mapped peripheral register.
|Is it possible to use PRACTICE macros inside dialogs?|
Yes. You should add the character "&" at the beginning of thr dialog block, otherwise macros won't be expanded inside that block.
|What's the long form and meaning of abbreviated TRACE32 commands in CMM scripts? Which shorter syntax is available?|
PRCTICE commands are not case sensitive. Each command has a long and short form. The significant letters are always written in upper case letters.
Example: the short form of SYStem.Up is SYS.U
You can execute this command as SYStem.Up, system.up, sys.up, system.u, ...
You can get open the documentation of a TRACE32 command by typing the command in long or short for in the TRACE32 command line then type space and press the F1 key. The corresponding PDF document will open at the correct location.
|WinPrint doesn't print the whole content of a TRACE32 window (e.g. FPU.view) to a file, I only get a part of the window printed.|
If the window you want to print is bigger that the screen, then you will get only the upper part of it using WinPrint.
To get the whole window, you should use WinPRT and WINPAN instead.
PRINTER.FILE fpu.txt /APPEND ; fpu.txt should be empty
WINPOS ,,180. 40. ,,, MYWIN FPU
WINPAN 0. -999.
SCREEN.WAIT ; necessary to update the screen after WINPAN if executing within a PRACTICE script
WINPRT MYWIN ; print first part
WINPAN 0 40. ; scroll down
SCREEN.WAIT ; update screen
WINPRT MYWIN ; print second part
Copyright © 2020 Lauterbach GmbH, Altlaufstr.40, 85635 Höhenkirchen-Siegertsbrunn, Germany
The information presented is intended to give overview information only.
Changes and technical enhancements or modifications can be made without notice. Report Errors
Last generated/modified: 30-Mar-2020