Procedure Summary
- Install the required packages mono-core and Xvfb
- Prepare a shell script file that sets the environment variables and runs CompileWorker.exe using mono.
- Setup the nifpgaworker.service for systemd, enable and register the service for automatic startup
- Configure the NI FPGA Compile Worker to connect to a CompileServer running on the network
- Compile an FPGA bitfile via the server and the Linux CompileWorker from a LabVIEW client.
Preparatory Steps
First, ensure that you have NI-FPGA including either the Xilinx Vivado or ISE toolkits installed. To do this, follow the instructions for
Setting up a Linux-Based FPGA Compile Worker.
Next, make sure that the
‘Xvfb’ X virtual frame buffer utility and mono runtime environment are installed with
sudo yum install Xvfb mono-core
Setting up the systemd service
Next, setup the Compile Worker caller script and systemd service as described below. The files mentioned in the how-to are given below. Ensure that you have root privileges when following the procedure.
- Create /etc/systemd/system/service/nifpgaworker.service with the contents below and mark it readable / writeable with chmod 664 /etc/systemd/system/nipfgaworker.service
- Create /usr/local/natinst/nifpgacompileworker/start_nifpgacompileworker.sh with the contents below and mark it executable via chmod 774 /usr/local/natinst/nifpgacompileworker/start_nifpgacompileworker.sh
- Setup the CompileServer by changing into the Compile workerdirectory cd /usr/local/natinst/nifpgacompileworker (adjust the path if it located in a different folder) and executing sh cw_wrapper.sh mono CompileWorker.exe. This needs to be done only during the first-time setup or when the Compile Server or its login credentials have changed.
- Enter the IP address of the Compile Server
- User is typically admin and password is empty per default
- Confirm the next dialogs with OK
- Kill the CompileServer process, i.e. with kill -9 <pid>. You can find the pid with pgrep -f CompileWorker
- Next, register the compile worker service with the following commands:
- systemctl daemon-reload
- systemctl enable nifpgaworker.service
- systemctl start nifpgaworker.service
SHELL SCRIPT file to call CompileWorker by the service
Should be placed as /usr/local/natinst/nifpgacompileworker/start_nifpgacompileworker.sh
#!/bin/bash
CW_PATH=/usr/local/natinst/nifpgacompileworker
export LD_LIBRARY_PATH=$DIR:/usr/local/natinst/mono/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/natinst/mono/bin/:$PATH
# This line is a workaround for Mono 4.0.4. Mono 4.2.1 has fixed the issue. See CAR #550029.
export MONO_XMLSERIALIZER_THS=no
# set screen to virtual framebuffer
# no worries, this will only apply to the contents of the shell file
if which Xvfb
then
Xvfb :1 -screen 0 1024x768x16 &
export DISPLAY=:1
fi
cd $CW_PATH
mono $CW_PATH/CompileWorker.exe
SYSTEMD service defintion file contents
Should be created as /etc/systemd/system/nifpgaworker.service
[Unit]
Description=NI FPGA Compile Worker Wrapper
[Service]
ExecStart=/usr/local/natinst/nifpgacompileworker/start_nifpgacompileworker.sh
ExecStop=
StandardOutput=syslog
StandardError=syslog
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=default.target