04-12-2012 05:47 PM
I need to be able to load an FPGA bitfile onto a cRIO target, using a Linux machine, but I don't see a way to do it.
There is a Linux & Windows tool to load a controller image, but it does not have FPGA capability:
http://joule.ni.com/nidu/cds/view/p/id/167/lang/en
And there is a Windows-only tool to load both a controller image and an FPGA bitfile:
http://digital.ni.com/public.nsf/allkb/595401C59F89ECCC862578CC005D0887
but so far I have been unable to find a Linux tool to load an FPGA bitfile.
Does anyone know of a way to do this?
Thanks for your help.
04-12-2012 06:27 PM
Note: if I try bringing "Download Bitfile.vi" (and all its dependencies) to a Linux machine, I see that it is looking for "niriosrv.so", but can't find it.
04-13-2012 11:53 AM
Hey Chris,
Have you seen this Developer Zone article from our site?
http://zone.ni.com/devzone/cda/tut/p/id/12008
This should give you the information you need in order to get your bit file to the cRIO with your Linux Machine.
Hope This Helps,
Doug B
04-13-2012 12:45 PM
Hi Doug, thank you for your response. Yes, I had seen that article, but the C interface that it talks about looks like it is intended as an add-on to the NI-RIO driver for writing C/C++ applications that *interact* with LabVIEW FPGA bitfiles. I don't need to do that. All I need to do is simply load a bitfile onto a cRIO FPGA, from a Linux machine. Any thoughts on how to accomplish this?
04-13-2012 03:47 PM
Doug,
Below is text taken directly from the "FPGA Interface C API Help" documentation. It looks like it is not useful for loading a bitfile file onto an FPGA, it is only useful for interacting with code.
**************************************************
The FPGA Interface C API enables C/C++ applications to interact directly with compiled LabVIEW FPGA VIs on RIO devices without using LabVIEW. C/C++ applications can download a VI to a RIO target, perform DMA data transfers, wait on and acknowledge interrupts, and read from and write to named controls and indicators using C function calls.
A C/C++ application created with the C API can run on the real-time processor of a CompactRIO or NI Single-Board RIO device, and interact with VIs running on the FPGA of the RIO system. Alternatively, a C/C++ application can run on the real-time processor of a PXI system or the processor of a Windows or Linux PC, and interact with VIs running on the FPGA of a PXI or PCI RIO device.
The current version of the C API does not support the following features.
04-13-2012 07:26 PM
in order to interact with the fpga, you have to load the bitfile. if you skip the interacting part, you have loaded the bitfile.
i am still not sure that this will work from linux though.
04-13-2012 08:34 PM
after reviewing the article posted above by Doug, i see that NI is describing support for linux.
based on our experience with calling FPGA from C under windows, i think this will work. like i said, skip the interactive part and you have loaded the bitfile.
04-16-2012 01:45 PM
Stu, thank you for your input. I'll take a closer look at the C utility. In the meantime, I have spoken with a co-worker, and he described a situation where he took a cRIO controller (having a /ni-rt/startup/startup.rtexe file on it) and plugged it into a brand-new backplane right out of the box. After inserting the appropriate modules, the controller was booted up, and it began acquiring data from the modules. This suggests to me that the startup.rtexe file contains the *.lvbit file, and loads it onto the FPGA when it starts up.
Is this how the startup.rtexe file works?
04-16-2012 03:15 PM
Chris 12345 wrote:
Is this how the startup.rtexe file works?
Yes. From http://digital.ni.com/public.nsf/allkb/17EA4DD6AAECD50A862570A7004B6146?OpenDocument: "neither the FPGA VI nor the Bit files will be included explicitly in the support files for the project. They are implicitly a part of the Real Time or host executable and will be deployed on the FPGA target once the executable is called on the Real Time Target or host."
04-16-2012 03:35 PM - edited 04-16-2012 03:38 PM
Eh, not exactly. The startup.rtexe DOES NOT contain the FPGA bitfile.
There are a couple ways to manage an FPGA image bitfile, depending on your distribution methodology and the requirements of the FPGA image. This document is a bit windows-centric, but it adequately describes the relationship between the application and the FPGA Bitfile:
http://zone.ni.com/devzone/cda/tut/p/id/9640
There are two ways to load a bitfile onto an FPGA with Linux - the easiest (by far) is to use the RIO Device Setup utility that comes included with the NI-RIO driver. It is distributed with Windows and Linux (as per the RIO PSE). This tool loads your bitfile directly into the FPGA EEPROM, so it can be automatically loaded when your system starts up. You can get information on this tool here:
http://digital.ni.com/public.nsf/allkb/BAAA6D86CDDD583C8625729E00572C8B?OpenDocument
However, if you need to "dynamically" load FPGA bitfiles (as in you cannot necessarily image each RIO individually, you prefer to do it programmatically when necessary or desired), the setup utility is probably not for you. You will need to use the FPGA Interface C API - this is used to interface directly with the FPGA (as opposed to the app running on the FPGA) to load the bitfile and launch the app. You can get information on how to do this here:
http://zone.ni.com/devzone/cda/tut/p/id/12008#
This should be all of the resources you need in order to load your bitfile with Linux.
-Danny