emuSync
The emuSync application offers coordinate use of multiple winIDEA sessions, synchronously starting and stopping parallel processors under winIDEA control.
emuSync is an iSYSTEM Open Source project shared on iSYSTEM GitHub. |
emuSync streamlines working with multiprocessor systems, allowing to keep track of the many different winIDEA applications controlling each processor, providing shorthands to operations that are commonly performed in all processors at once (download, start, etc) and automatizing synchronous starts and stops.
When using emuSync a list of winIDEA workspaces is specified, where each one can be master and/or slave. Stopping master workspace causes all slave work spaces to stop. Optionally all slave work spaces could be started if a master work spaces runs. EmuSync can load and save different configurations.
emuSync is a single window application divided in four parts:
Configuration |
Display and access to configuration operations.
Instance workspaces |
The instances list displays the list of work spaces that compose the current configuration.
Selected Instance |
Displays the path to the currently selected instance and provides access to operations and properties of this instance. Different commands for operating winIDEA instances are available.
All instances |
Groups operations that are performed on all instances.
Configuration information is saved into text files with the .EmuSync extension, which can be manually edited. The file is located in the winIDEA installation folder: C:\iSYSTEM\winIDEA9\scripts\emuSync.
The configuration file itself includes three main sections:
•Configuration: This is where the selected winIDEA workspaces are specified (wsPath field) and their operation mode (opMode field: master/slave) is defined.
•Logging: If the “enable” field is set to true, the logging menu appears in the EmuSync main menu bar.
•Module: Each of the available hooks has its own specified file path (hookPath field), name of python hook start method/function (hookStart field) and an enable field (isActive).
The configuration section displays the path to the active configuration file. The button displays a pop-up menu with self-explanatory commands New, Open, Save, Save as.
•Always on top - When checked keeps the EmuSync window above all other windows
Below is an example of a configurations file:
configuration:
- opMode: master
wsPath: C:\winIDEADemos\Sample1.xjrf
- opMode: slave
wsPath: C:\winIDEADemos\Sample2.xjrf
- opMode: slave
wsPath: C:\winIDEADemos\Sample3.xjrf
logging:
enable: false
module:
onDownload:
hookPath: emuSyncHooks.py
hookStart: onDownloadHook
isActive: false
onReset:
hookPath: emuSyncHooks.py
hookStart: onResetHook
isActive: false
onRun:
hookPath: emuSyncHooks.py
hookStart: onRunHook
isActive: false
onStop:
hookPath: emuSyncHooks.py
hookStart: onStopHook
isActive: false
preDownload:
hookPath: emuSyncHooks.py
hookStart: preDownloadHook
isActive: false
preReset:
hookPath: emuSyncHooks.py
hookStart: preResetHook
isActive: false
preRun:
hookPath: emuSyncHooks.py
hookStart: preRunHook
isActive: false
preStop:
hookPath: emuSyncHooks.py
hookStart: preStopHook
isActive: false
Each line of the list displays the number ID of the instance, its master and slave properties, its status, and the path to the workspace.
•Add - Add a workspace to the list
•Remove - Deletes the currently selected instance (row) from the list
Status |
Description |
---|---|
Workspace not attached to a winIDEA process |
|
![]() |
winIDEA is not connected to the debugger |
![]() |
Core execution is halted |
![]() |
winIDEA instance is in the stop mode. |
![]() |
winIDEA instance is in the running mode |
![]() |
winIDEA instance is detached |
Depending on the status of the workspace different commands are available. All of them are available as buttons and their name describes their function. To operate multiple winIDEA instances from EmuSync application, you need to Launch them first.
•Launch - Launch a new winIDEA instance and attach to it.
•Close - Close winIDEA instance
•Attach - Attach to an open winIDEA instance or open one if no suitable instance is found.
•Detach - Detach/disconnect from winIDEA instance
•Run - Start/continue core execution
•Stop - Stop core execution
•Download - Download files to the target CPU
•Reset - Trigger a reset on the core
•Master / Slave radio buttons- Display the properties and can be used to toggle them
The command buttons available in the Selected instance section are duplicated here, but they operate on all instances at the same time. The check boxes on the bottom are global options.
•Run slaves when master runs - If enabled, the master workspace entering running status causes all slaves to run
•Close all on exit - If enabled causes all associated winIDEA applications to be closed when EmuSync is closed
There are additional options available in the applications menu bar:
•Use Demo mode - Toggle Demo mode across all winIDEA instances.
•Module data - Provide a quick overview of the module and hook related settings in the currently loaded configuration file. To edit these settings, edit the configuration file itself and then reload it in the EmuSync application.
emuSync allows the user to implement its own python hooks (or scripts) and runs them according to the selected command. Hook paths and starting methods for each of the supported events are defined in the configuration .emuSync file. If a specific hook is enabled in the configuration file, then it will be executed every time the specific command is given to a winIDEA instance.
•onDownload (after Download)
•onReset (after Reset)
•onRun (after Run)
•onStop (after Stop)
•preDownload (before Download)
•preReset (before Reset)
•preRun (before Run)
•preStop (before Stop)
The only requirement for a hook is that it can be passed an instance of the ConnectionMgr class. This enables you to create any and all of the other classes and managers available in the isystem.connect SDKs and manipulate winIDEA instances. No logging handler is passed, so you must implement your own logging solution if needed.
This is a hypothetical situation where I wish to run a custom python script after a Stop command is executed on the CPU.
Here is a step-by-step example on what you need to do:
1. Prepare your python script. In this example the script file is called “onStopScript.py” and it is located on my Desktop. Inside the file, there is a function called “onStopHook” which is the one I want EmuSync to run after Stop commands.
onStopScript.py:
import isystem.connect as ic
import time
# The connection manager is passed to the hook from EmuSync so that you can manipulate winIDEA inside the hook.
def onStopHook(connMgr):
loaderMgr = ic.CLoaderController(connMgr)
loaderMgr.download()
executionMgr = ic.CExecutionController(connMgr)
executionMgr.run()
time.sleep(5)
executionMgr.stop()
print(“Hook over.”)
2. In your configuration file, update the hookPath and hookStart of the “onStop” hook type to correspond with your python script path and python method/function you wish to call.
3. In your configuration file, set the “isActive:” field of the “onStop” hook to True and save the file.
Configuration file excerpt:
module:
onStop:
hookPath: C:\Users\User1\Desktop\onStopScript.py
hookStart: onStopHook
isActive: True
…
4. Open this configuration file in EmuSync.
To enable logging to file, set the logging: enable: from False to True in the Configurations file before it is loaded. This will enable a logging menu in the application menu bar. There you can select the desired logging level and open the folder containing the log files.