Automatically load fpga_0.94.bit on system startup
Posted: Mon Mar 04, 2019 7:15 am
Problem:
I have several C/C++ applications built for the RedPitaya which use the API (rp.so).The manual says, that in order to use the API, I have to load an FPGA image by doing. When I do it from command line (e.g. console) everything works. When I do not do it, the code crashes with SIGBUS.
I need to load it automatically, before my program starts.
What did I do to solve it
I am starting my program as a linux systemd daemon. A file was created
The unit file is as follows:
however every other boot the system hangs, blue light is off.
I thought to replace the cat with so that the entire file is first read then dumped to FPGA. This did not help.
Other system information
RedPitaya 1.1, Latest stable image from
Ecosystem 0.98
Questions
How do I load the bitfile automatically before my application start so that everything does not crash?
I attempted to load it right after local-fs.target is reached (early in the boot process) as well as after multi-user.target is reached (late in the boot process) with the same results.
Should I look instead into configuring FSBL to load the fpga_0.94.bit instead whatever it is loading now?
Or can U-Boot do it?
Is it OK for FSBL to load that bitfile (version 0.94) although the ecosystem is 0.98?
I have several C/C++ applications built for the RedPitaya which use the API (rp.so).The manual says, that in order to use the API, I have to load an FPGA image by doing
Code: Select all
cat /opt/redpitaya/fpga/fpga_0.94.bit > /dev/xdevcfg
I need to load it automatically, before my program starts.
What did I do to solve it
I am starting my program as a linux systemd daemon. A file was created
Code: Select all
#!/bin/bash
cat /opt/redpitaya/fpga/fpga_0.94.bit > /dev/xdevcfg
sleep 2
exec /root/XXX/YYY
Code: Select all
[Unit]
Description = RedPitaya WaveformGenerator
After = network.target
Requires=ZZZZ
[Service]
Environment="LD_LIBRARY_PATH=/opt/redpitaya/lib"
ExecStart = /root/XXX/YYY.sh
[Install]
WantedBy = multi-user.target
I thought to replace the cat with
Code: Select all
dd if=/opt/redpitaya/fpga/fpga_0.94.bit of=/dev/xdevcfg ibs=1M
Other system information
RedPitaya 1.1, Latest stable image from
Ecosystem 0.98
Questions
How do I load the bitfile automatically before my application start so that everything does not crash?
I attempted to load it right after local-fs.target is reached (early in the boot process) as well as after multi-user.target is reached (late in the boot process) with the same results.
Should I look instead into configuring FSBL to load the fpga_0.94.bit instead whatever it is loading now?
Or can U-Boot do it?
Is it OK for FSBL to load that bitfile (version 0.94) although the ecosystem is 0.98?