Command Line Interface
The command line interface (CLI) is easy to use and provides built in help for different commands. To start the command line tool do the following (assuming you are running bash).
# Set the PATH to include the temu command line application $ PATH=/opt/temu/bin:$PATH # Start TEMU $ temu no such file: '~/.config/temu/init' no such file: './temu-init' temu>
As can be seen above, the command line tool complains about two missing files.
These are nothing to bother about at the moment.
The files are used to automatically run a set of commands when you start the
It is possible to get a list of commands by typing
Help for an individual command (including lists of arguments the command takes) can be produced by typing
The command line interface support the execution of non-interactive batch sessions via the
Multiple run flags can be given to have scripts executed in order.
On the first error in a script, TEMU will terminate and not proceed with the next script.
Run the TEMU command-script (CLI-script) in the given file in non-interactive mode. You can provide this option multiple times to execute multiple scripts in sequence. When the last script finishes, the emulator will quit.
Run [cmd] as a single command as if typed in the interactive command line.
Run the Python script in the given file in a non-interactive TEMU-session. The option can be provided multiple times, and scripts will be executed in the sequence they are given on the command line.
Enter interactive mode after processing
--run*flags. Note that any failed scripts will still terminate TEMU before the interactive mode is entered.
Install a license file.
Revoke an installed license.
List all installed licenses
When running both CLI scripts and Python scripts, the order will be as specified in the arguments to TEMU. It is possible to run a Python script first, followed by a CLI script or the other way around.
It is also possible to specify a list of scripts without the
--run-commands/--run-script flags above, in that case the file type is inferred by the file extension, where the extension
.temu will be treated as a TEMU script and the
.py extension as a Python script.
Passing file names this way will also result in a non-interactive session.
Normally commands are named by a noun-verb format (but there are abbreviations as well).
Commands take either a set of named arguments, but some (like the help command) also take positional arguments.
In the named format, each argument is separated by a space, and defined using key-value pairs as e.g.
The command line allows for variables to be set.
These can be set using the
Variables are expanded if they are given as argument values to commands.
When used, variables are referenced as
Each command is self-documenting, typing help will show a list of available commands.
help command=memory-assemble will show the detailed help for the
memory-assemble command, including all arguments and their types.
This section list some of the commands provided in the CLI. A full list can be generated by running the help command.
There are two commands for working with snapshots, the save and restore command.
This command restores a serialized snapshot from a file. The read file should be a JSON file written by the save command.
The save function writes a snapshot in JSON format to disk. Memory content is typically dumped as raw data in a binary blob (in an auxiliary file). The endianness of this blob is for RAM and ROM contents in the standard models is in host order where the unit size is the word size of the target. For the SPARCv8 target on an x86-64 host this means that the data is stored as sequence of little-endian 32-bit words.
This command assembles a string into memory.
This command disassembles memory contents. As assemblers are target dependent, the command takes a CPU parameter.
Load executable file (SREC or ELF format). The Command automatically detects the format of the file.
Read memory and write it to the console.
Modify memory content.
Map object to memory space. The command assigns an object to an address range in the memory space.
When dealing with the emulator object system in the CLI, there are a number of commands that are useful. These include the following:
Creates an object, the command takes two or three parameters. The class parameter indicates the class of the object to be created, name indicates the object name (this name should be unique) and the third optional parameter
argsallows you to list a number of arguments formatted as
name:valuepairs in a comma separated list. The arguments are class specific, consult the class documentation on the allowed arguments. Example
object-create class=Leon3 name=cpu0 args="cpuid:0"
Connect two objects together. The command connects an object reference property to an interface provided by another object. The command takes two parameters, parameter a is the property formed as
objname.propname, parameter b is the interface reference that the property should refer to, this is formed as
connect a=cpu0.memAccess b=cpu0:MmuMemAccessIface,
connect a=cpu0.memAccessL2 b=mem0:MemAccessIface
This command prints the properties in an object.
List the names of all objects created with object-create.
In order to assign property values using the property read and write mechanism this command provides that functionality. Depending on the model, a write may have side-effects (by invoking a write handler), side-effects are documented in the model manuals.
There are several commands in the CLI that helps you deal with and to load plugins.
All of these commands have the prefix
Add path to plugin search paths
Load a plugin
Remove path from plugin search path
Print the search paths for plugins
Unload a plugin
- run (object-run)
Run the machine or CPU for a given time
- step (object-step)
Step the machine or CPU for a given number of steps