Professional Documents
Culture Documents
PMACRO.EXPLICIT
//Enforce explicit macro declaration
GLOBAL &SessionStart
LOCAL &msg1 &started &linecount
PRIVATE &val1 &val2
Literals
Decimal
Float
Hexadecimal
Binary
Bitmask
Hexmask
Boolean
String
Character
Address
Addr. with Segment
Address Range
HLL Symbol
197.
197.0 or 9.75
0xC5
0y0011000101
0y0011xx01xx
0x10XX
TRUE() or FALSE() or &i<20.
"abc" or "escape ""it"" "
'a'
P:0x100
P:0x02:0x100
P:0x100--0x1ff
P:0x100++0x0ff
`main` //These `` are backticks.
Operator Precedence
Path Prefixes
./
~/
~~/
~~~/
~~~~/
OS.PWD()
OS.PHD()
OS.PSD()
OS.PTD()
OS.PPD()
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
( ) {
-- ++
+ - ~
<< >>
* / %
+ - +
== !=
&
^
|
&&
^^
||
}
..
!
www.lauterbach.com/referencecards.html
&SessionStart=CLOCK.DATE()
&msg1="Hello World!"
&started=TRUE()
&linecount=0.
&val1=Var.VALUE(flags[3])
&val2=Data.Byte(flags+3)
//No spaces at =
//Note the trailing dot
//Assign value of C variable
//Assign a memory value
Whitespace
PRACTICE is whitespace sensitive. There must be at least one
space after every command, e.g.:
is wrong (error: unknown command)
WHILE(&i>5)
WHILE(&i>5)
is correct
Expressions like (5+0x20)|0x100 must not contain any
whitespaces.
SYStem.DETECT IDCode
//Get JTAG ID
IF IDCODE(0)==0x049220DD
(
SYStem.CPU EPXA
)
ELSE IF IDCODE(0)==0x4BA00477
(
SYStem.CPU MK60DN512VMD10
)
ELSE
(
SYStem.CPU ARM7TDMI
)
//Excalibur chip
IF !&result
PRINT "Failed at &addr"
ENDDO
//MK60 chip
While Loop
;Loop while &i is smaller 10
Data.COPY
&from++(&size-1) &to
Data.ComPare &from++(&size-1) &to
&err=!FOUND() ;Returns TRUE() or FALSE()
&eaddr=ADDRESS.OFFSET(TRACK.ADDRESS())
RETURN &err &eaddr
LOCAL &i
&i=0.
WHILE &i<10.
(
PRINT "Count: " &i
&i=&i+1.
)
copydata:
;Labels must start in the first column!
LOCAL &from &to &size &err &eaddr
ENTRY &from &to &size
CLOSE #1
"
RePeaT 50.
;Loop 50 times
(
;Increase progress bar
PRINT %CONTinue "*" ;Write * at end of previous line
WAIT 100.ms
;Pause script for 100.ms
)
WAIT 1.s can be used to wait for e.g. a target bootloader.
Yes-No Dialog
LOCAL &yes
DIALOG.YESNO "Do you want to close TRACE32?"
ENTRY &yes
caller-world.cmm (file 1)
LOCAL &answer
IF &yes
QUIT 0
ENDDO
world.cmm (file 2)
LOCAL &msg &result
www.lauterbach.com/referencecards.html
)
DIALOG.Set textbox "Hello User!"
DIALOG.Disable textbox ;Gray out text box
STOP ;Wait for the users response to the dialog
PRINT "Clicked OK!"
PRINT "Message: " DIALOG.STRing(textbox)
closeDialog: ;Labels must start in the first column!
DIALOG.END