silayer server - ComPair/ComPair-tracker-FPGA GitHub Wiki

Silayer Server

This is a persistent server that runs on the zynq. While it is running, you can use the silayer.Client class found in ComPair-tracker-FPGA/src/py/silayer to run commands and stream data remotely

Build steps

Build sictrl library

We will need to combine the vata_ctrl.cpp and cal_ctrl.cpp together in a library, which we'll call sictrl. Soon this will also include dac_ctrl.cpp, but not yet.

Ordinarily we would use petalinux for this; until the issues with calctrl are resolved, we will have to use the vivado SDK to build the library.

To start the library project, in Vivado SDK: File -> New -> Other, and select "Xilinx", then "Library Project". I name the library sictrl, since it's rolling all the *ctrl stuff together. Choose the static library option and C++ project.

Now, copy the cal_ctrl.cpp and vata_ctrl.cpp into the project's source directory. These files can be found in our petalinux application: ComPair-tracker-FPGA/src/petalinux/si-layer/project-spec/meta-user/recipes-apps/vatactrl/files/vatactrl/src

Next, copy all .hpp file in the include directory to the library project's source directory. To be explicit, the include directory is at: ComPair-tracker-FPGA/src/petalinux/si-layer/project-spec/meta-user/recipes-apps/vatactrl/files/vatactrl/include

After copying the files, refresh the library project.

Now, you will need to include the xilinx headers. Right click on the sictrl folder, and select Properties. Go Down to C/C++ Build -> Settings, and click Directories. Hit the little page with the green plus symbol to add an include path. Add the include path under petalinux_bsp, which should have been automatically built.

Now, build the project, and the library should show up in the Debug folder. scp libsictrl.a over to the zynq, to a sensible location, say /home/root/lib/

Build zmq on the zynq

Get the zmq source: https://github.com/zeromq/libzmq/releases/tag/v4.3.2

Build this on the zynq. Install to a reasonable location (like, set the prefix to $HOME)

Next, get the header-only c++ bindings: https://github.com/zeromq/cppzmq/releases/tag/v4.6.0

Install this to a reasonable location on the zynq. Note that you could just take the zmq.hpp file and copy it to an include directory, and it would be installed.

Copy our .hpp files to the zynq

I am unsure if this is necessary, but scp the .hpp files you used to build the sictrl library to the zynq, putting them somewhere reasonable

Build silayer_server

scp the directory found at ComPair-tracker-FPGA/src/petalinux/apps/silayer-server onto the zynq.

Now, ssh to the zynq, and go into the silayer-server directory. Check the Makefile, to make sure that the include directories and library directories are where you installed sictrl and zmq.

Then, you should just have to run make to produce the silayer_server executable.

Usage

To run the server, just execute ./silayer_server. Currently, with things being debugged, the server is very verbose, so you will know what it is doing and if requests are being heard.

Once the server is running, you will want to use the silayer python package to run commands. This package is located in ComPair-tracker-FPGA/src/py/silayer. You can install it with the standard python setup.py install --prefix=YOUR-PREFIX.

You will specifically want to use the silayer.Client class for issuing commands (source for that is in ComPair-tracker-FPGA/src/py/silayer/python/client.py.

Currently, the client defaults to connecting to the hostname "si-layer.local". If you haven't set up avahi on the zynq, or if you ended up with a different host name, edit client.py's SILAYER_HOST at the top of the module. You can also change the hostname with a keyword to the initializer.