
GRMON3-UM
June 2019, Version 3.1.0
225
www.cobham.com/gaisler
Appendix C. Tcl API
GRMON will automatically load the scripts in GRMON
appdata
folder. On Linux the
appdata
folder is
located in
~/.grmon-3.0/
and on Windows it's typically located at
C:\Users\%username%\AppDa-
ta\Roaming\Cobham Gaisler\GRMON\3.0
. In the folder there are two different sub folders where scripts
may be found,
<appdata>/scripts/sys
and
<appdata>/scripts/user
. Scripts located in the sys-
folder will be loaded into the system shell only, before the Plug and Play area is scanned, i.e. drivers and fix-ups
should be defined here. The scripts found in the user-folder will be loaded into all shells (including the system
shell), i.e. all user defined commands and hooks should be defined there.
In addition there are two commandline switches
-udrv
<filename>
and
-ucmd
<filename>
to load scripts
into the system shell or all shells.
TCL API switches:
-udrv<filename>
Load script specified by filename into system shell. This option is mainly used for user defined drivers.
-ucmd<filename>
Load script specified by filename into all shells, including the system shell. This option is mainly used for
user defined procedures and hooks.
Also the TCL command source or GRMON command batch can be used to load a script into a single shell.
The variable TCL
grmon_shell
can be used to identify a shell. This can used to run shell specific code from a
script is intended to be used in multiple shells. GRMON creates the following shells:
sys
System shell
exec
Execution shell
cli
Command line interface shell
term#
GUI terminal shell (# is replaced by a number)
gdb
GDB remote server shell
Example using shell name:
if {$grmon_shell == "cli"} {
puts "Hello CLI!"
}
1. Device names
All GRLIB cores are assigned a unique
adevN
name, where N is a unique number. The debug driver controlling
the core also provides an alias which is easier to remember. For example the name
mctrl0
will point to the first
MCTRL regardless in which order the AMBA Plug and Play is assigned, thus the name will be consistent between
different chips. The names of the cores are listed in the output of the GRMON command info sys.
PCI devices can also be registered into GRMON's device handling system using one of the pci conf -reg, pci
scan -reg or pci bus reg commands. The devices are handled similar to GRLIB devices, however their base name
is
pdevN
.
It is possible to specify one or more device names as an argument to the GRMON commands info sys and info
reg to show information about those devices only. For info reg a register name can also be specified by appending
the register name to the device name separated by colon. Register names are the same as described in Section 2,
“Variables”.
For each device in a GRLIB system, a namespace will be created. The name of the namespace will be the same
as the name of the device. Inside the namespace Plug and Play information is available as variables. Most debug
drivers also provide direct access to APB or AHB registers through variables in the namespace. See Section 2,
“Variables” for more details about variables.