Skip to the content.

How to Simplify Starting CoSimulation

It can be tedioius to work with 3 terminals at the same time to get the cosimulation running. Linux has beauitful automations available to help: TMUX This page describes how to harness TMUX to create the 3 windows and launch the comimulation with one command.

1. Installation

Install tmux instructions.

2. Configuration Script and Integration

The following tmux configuration script creates the window configuration and launches all at the same time. Save it into ~/tmux_cosim.conf

# setup cosim session T0
new-session -s cosim -n cosim -d -c ~/myLaunch
send-keys 'cd BASEDIRREPLACE/hw' Enter
send-keys 'make launch_cosim' Enter

# new pane vertical 15% creating T1
split-window -v -p 15 -c ~/myLaunch
send-keys 'setup-xarm' Enter
send-keys 'cd BASEDIRREPLACE/sw' Enter
send-keys 'make' Enter
send-keys 'sleep 20' Enter
send-keys 'make upload' Enter

# Select top
select-pane -t 0

# new pane horizontal 50%
split-window -h -p 50 -c ~/myLaunch
send-keys 'setup-xarm' Enter
send-keys 'cd BASEDIRREPLACE/sw' Enter
send-keys 'qemu-esl --cosim' Enter

# Select QEMU pane
select-pane -t 1
~

Note the script uses BASEDIRREPACE string for the directory where to start from. To make the script transferable (across directories), I am using an alias:

alias cosim-start='sed "s|BASEDIRREPLACE|${PWD}|g" ~/tmux_cosim.conf > ~/.tmpTmuxStart; tmux -f ~/.tmpTmuxStart attach'

Place this into the end of your ~/.bashrc.

Now open a new shell to activate the new alias.

3. Starting Cosimulation

  1. Open a shell but without the xarm enviroment active (it will be activated by tmux script).
  2. Go to the base directory of your cosim project (which contains hw and sw folders).
  3. ‘cosim-start`
  4. Enjoy cosimulation

To close the tmux session, just exit out of the three shells.