Butler scripting interface¶
When controlling the EMP firmware, you will typically need to run a sequence of several empbutler
commands in order to carry out a test (e.g. playing data through your payload firmware, and capturing the outputs). If you need to repeat these procedures several times, running the same sequence of commands manually can become tedious (and unexpected behaviour can easily occur from human error). Instead, you can write down the list of empbutler do
subcommands in a text file (without the empbutler do
prefix), and then use the empbutler script
command to execute those commands.
Specifically, the empbutler script
command accepts one argument: the path to the file containing the empbutler do
subcommands. In this file, lines that begin with #
or only contain whitespace are ignored, and all other lines are assumed to contain subcommands of empbutler do
.
Example: Link loopback pattern test¶
If you wanted to configure the EMP links in loopback mode, and play a simple pattern through them, you could run the following commands (replacing CONNECTIONS_FILE.xml
, DEVICE_ID
and CHANNEL_LIST
with appropriate values):
empbutler -c CONNECTIONS_FILE.xml do DEVICE_ID reset internal
empbutler -c CONNECTIONS_FILE.xml do DEVICE_ID buffers tx PlayOnce -c CHANNEL_LIST --inject generate://pattern
empbutler -c CONNECTIONS_FILE.xml do DEVICE_ID mgts configure tx -c CHANNEL_LIST --loopback=nearPMA
empbutler -c CONNECTIONS_FILE.xml do DEVICE_ID mgts configure rx -c CHANNEL_LIST
empbutler -c CONNECTIONS_FILE.xml do DEVICE_ID mgts align -c CHANNEL_LIST
empbutler -c CONNECTIONS_FILE.xml do DEVICE_ID buffers rx Capture -c CHANNEL_LIST
empbutler -c CONNECTIONS_FILE.xml do DEVICE_ID capture --rx CHANNEL_LIST --tx CHANNEL_LIST
If you or your group need to run this procedure repeatedly, you could instead save the list of subcommands in a text file (e.g. myLoopbackCommands.txt
):
DEVICE_ID reset internal
DEVICE_ID buffers tx PlayOnce -c CHANNEL_LIST --inject generate://pattern
DEVICE_ID mgts configure tx -c CHANNEL_LIST --loopback=nearPMA
DEVICE_ID mgts configure rx -c CHANNEL_LIST
DEVICE_ID mgts align -c CHANNEL_LIST
DEVICE_ID buffers rx Capture -c CHANNEL_LIST
DEVICE_ID capture --rx CHANNEL_LIST --tx CHANNEL_LIST
And then execute all of these subcommands from that list by running the following empbutler script
command:
empbutler -c CONNECTIONS_FILE.xml script myLoopbackCommands.txt