Skip to content

Silicon Heaven Support

Pavel Pisa edited this page Mar 1, 2024 · 9 revisions

Silicon Heaven (SHV) is an open source infrastructure developed at Czech company Elektroline. It implements ChainPack, an open remote procedure call protocol (RPC) for data serialization which is used in company's systems around the whole world.

The support of SHV will be introduced to pysimCoder in the upcoming days. It allows the user the runtime monitoring and tuning of model parameters and the introspection of designed diagram. This wiki page can be used as a step by step manual how to successfully run pysimCoder application with implemented SHV infrastructure.

General SHV Introduction

Apart from ChainPack, SHV offers repositories shvspy and shvapp. The second mentioned implements an application called shvbroker. This broker acts as a server in our system and sends requests to the clients (for example our pysimCoder application). shvspy is a GUI tool from which user can connect to the broker and control is (i.e. send requests and interact with the client from GUI interface). The communication is done over TCP.

Data, in our case pysimCoder's blocks, their parameters, inputs and outputs, are represented in form of the tree with the following format.

  • project name
    • blocks
      • block 1
        • inputs
          • input 1
        • outputs
          • output 1
        • parameters
          • double 1
      • block 2

Only double parameters are currently supported. Most of the parameters have their name assigned however some exceptions may occur. In that case the parameters use the naming double0, double1 etc.

Broker interacts with the clients with so called methods (for ChainPack data format please see SHV documentation). Each item in a tree has to support two methods: dir and ls. The first one returns the list of supported methods, the second one the list of item's children. Parameters/inputs/outputs also support methods get, set and typeName or just get and typeName if they are read only (parameters are read-write, block's inputs/outputs read only). Those methods can be easily called from shvspy application.

SHV in pysimCoder

Silicon Heaven is currently supported for LinuxRT and NuttX targets. Compilation process in devices folder requires to run make with additional parameter:

make SHV=1

This will automatically download necessary libraries and compile required files.

Silicon Heaven options can be setup in pysimCoder settings under SHV Support button or in menu under Communication/SHV Support. This opens a dialog window with following options:

  • Enable SHV Protocol: yes or no
  • SHV Broker IP: broker IP address
  • SHV Broker Port: broker port number
  • SHV Broker User: broker login username
  • SHV Broker Password: broker login password
  • SHV Device ID: device name (user choice)
  • SHV Device Mount Point: mount point to broker tree, application will be under path mount_point/device_id

Please note that lots of parameters are dependant on server properties that are set by its configuration file (discussed later).

User can also select from two type of trees: GAVL (generated AVL tree) and GSA (generated sorted array). GSA tree can be created statically during code generation and be saved in microcontroller's flash memory, GAVL is created at runtime during application start.

Currently all blocks' double parameters and inputs/outputs are propagated to the SHV tree and it is not possible to select what parameters should be read only.

Using SHV with pysimCoder

This section describes SHV related operations after pysimCoder application is created (with make SHV=1 command and set up SHV options). As desrcibed in previous sections, applications shvbroker and shvspy are required to use SHV in pysimCoder.

Application shvbroker, which redirects requests (methods) between clients, can be set up by following commands.

git clone https://github.com/silicon-heaven/shvapp.git
cd shvapp
git submodule update --init --recursive
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=.. ..
make
make install
cd ../bin
./shvbroker --config-dir ../shvbroker/etc/shv/shvbroker/ -v rpcmsg

The last command runs the broker. Path ../shvbroker/etc/shv/shvbroker/ contains configuration options for the broker as login name, login password, port and so on. Those are the options that are put in pysimCoder GUI. PysimCoder currently supports only plain password, support for SHA-1 hash is not added yet. Another application we need to use is shvspy. Note that this application may require new QT6 packages to be installed on your system. You may also use Nix to obtain those packages.

git clone https://github.com/silicon-heaven/shvspy
cd shvspy
git submodule update --init --recursive
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=.. ..
make
make install
cd ../bin
LD_LIBRARY_PATH=../lib ./shvspy -v rpcmsg

Once again the last command runs the application. It opens a GUI to which user can add a new server and connect to it (server's parameters are again the ones from broker's configuration file). The user can run his pysimCoder application on Linux or NuttX and browse throught the SHV tree and change model's parameters or see his inputs/outputs. The following image (taken from shvspy repository) shows shvspy interface.

SHVSPy windows