NI VeriStand Add-Ons Documents

Showing results for 
Search instead for 
Did you mean: 

How to run a custom device on target RT Linux

by Active Participant Dagaror ‎04-19-2016 04:34 AM - edited ‎01-30-2017 10:51 AM

NI VeriStand 2015 has introduced the support of Linux targets (x64 and ARM). This document pretends to lead you step by step how to modify the custom device source code so you can run it on targets Linux RT.

The changes are at Custom Device Source Code LabVIEW Project Level and at file XML level.

LabVIEW Custom Device Source Code

  1. Create a new custom device by following this steps or take an already implemented custom device.
  2. Add an offline Linux RT Target to the LabVIEW project as it is described here
  3. Add the RT Driver VI.vi under the Linux RT Target. (Do not canceled from LabVIEW Project My System side) 1.png
  4. Add “Engine” Source Distribution to Build Specifications by right-clicking Build Specifications >>New>>Source Distribution.
  5. Information Category:
    • Name it as Engine.
    • Local destination path must create a folder called “Built” at same location path than the custom device folder. The path must be like this:
      C:\...\Built\Custom Devices\”Name Custom Device”
    • Target destination directory:
      • /Linux_32_ARM/Engine LinuxARM.llb
      • /Linux_x64/Engine Linux64.llb
  6. Add the RT Driver VI.vi as “Always Included” on the Source Files category.
  7. Destination Category:
    • Destination Directory --> /Linux_x64/Engine Linux64.llb (Destination type: LLB)
    • Support Directory -->/Linux_x64/data
  8. Source File Settings Category: Select destination for RT Driver VI.vi to the Destination Directory.
  9. Additional Exclusions settings:
    2.png
  10. Add a post build action. You find a VI called “Copy.LLB to NI VeriStand” attached. It should be executed after you build the LLB in order to copy the LLB under <Public Documents>\National Instruments\NI VeriStand 20xx\Custom Devices.
    The path from step 5 b. above must be as it is described, otherwise the Copy.LLB to NI VeriStand.vi does not work.

File XML

Add the supportedTarget to the file XML how it is showed in the screenshot. VeriStand will translate to Linux path format (/C/ni-rt/VeriStand/Custom Devices/Custom Device/Custom Device Linux_x64Engine.llb) during deploy process.

3.png

Requirements:

LabVIEW 2015 or higher.

VeriStand 2015 or higher.


Comments
Active Participant Jiri_K
Active Participant

Example of the XML also at this custom device:

https://github.com/NIVeriStandAdd-Ons/Scan-Engine-Custom-Device

Member ARLROB
Member

I am having trouble getting this to work,  when I try to add my custom device to my veristand project I get the following error

Error 1172 occurred at Invoke Node System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

    Inner Exception: System.ArgumentException: Illegal characters in path.

I also notice that when I look at what files get added to my custom device directory I do not see the follong files or directories

Data\NIVeriStand_DataServices.dll

Linux_32_ARM\data\NIVeriStand_DataServices.dll

any suggestions?

Member Andy-C
Member

Hi ARLROB,

I don't think either of those DLLs are actually used on the Linux targets, though I'm not 100% sure what they are used for. It sounds like the error occurs when you right-click the Custom Devices section in your Sys Def and try to add your custom device, but let me know if that's not the case.

I would instead focus on the configuration code and the XML file associated with your custom device.

Specifically I would focus on the code in your Initialization VI and the Main Page VI as this is the code that runs when a custom device is added to the system definition. For quick debugging purposes you can add One Button Dialogs (or other debugging tools supported on Windows) to the configuration code to pinpoint where the error is occurring when you add the custom device to the project.

It is also possible that VeriStand is having trouble parsing the XML file associated with the custom device, so look for any file path errors (especially given the specific error you're receiving) or other typos in your XML, especially if you are using extra pages.

I hope this helps!

Andy

Member ARLROB
Member

Here is my xml file. I think I followed the right steps to customize it. Can you see if it looks correct?

Member ARLROB
Member

I have added dialog windows to debug, I do not get a window popping up for the initialization VI.

Also when adding the supported target to the XML file, should I have both pharlapWindows and linux_32 supported devices?

Member Andy-C
Member

Hi ARLROB,

The Init VI only runs when you're adding the custom device for the first time, so it won't run unless you delete & re-add the custom device.

If you don't mind posting your XML I'll be glad to look over it quickly and look for any obvious problems. You can also send it my way via PM if you'd prefer.

Andy

Member ARLROB
Member

I am getting the error when I try to add the device, and since the dialog box does not appear I must assume that my initialization VI is not being run

Member ARLROB
Member

xml.png

Member Andy-C
Member

That sounds correct to me - if that error occurs before the dialog then the Init code probably isn't running. That makes me think the problem is with the syntax of the XML file.

Edit: Thanks for posting the image - nothing jumps out at me immediately. If you can post the actual .xml file I can try to load it in my environment and see what happens.

Member ARLROB
Member

<?xml version="1.0" encoding="utf-8"?>

<CustomDevice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Custom Device.xsd">

<XSDVersion Major="2010" Minor="0" Fix="0" Build="0" />

  <AddMenu>

    <eng>DVLMsg_Handler</eng>

    <loc>DVLMsg_Handler</loc>

  </AddMenu>

  <Version>1.0</Version>

  <Type>Asynchronous</Type>

  <MaxOccurrence>2474</MaxOccurrence>

  <MainPageGUID>063b8f0b-616f-4884-bb4b-a6c55cedf529</MainPageGUID>

  <InitializationVI>

    <Type>Action</Type>

    <Item2Launch>

      <Type>To Common Doc Dir</Type>

        <Path>Custom Devices\DVLMsg_Handler\DVLMsg_Handler Configuration.llb\DVLMsg_Handler Initialization VI.vi</Path>

    </Item2Launch>

  </InitializationVI>

  <CustomDeviceVI>

        <SourceDistribution>

            <Source>

                <SupportedTarget>PharlapWindows</SupportedTarget>

                <Source>

                    <Type>To Common Doc Dir</Type>

                    <Path>Custom Devices\DVLMsg_Handler\DVLMsg_Handler Engine.llb\DVLMsg_Handler RT Driver VI.vi</Path>

                </Source>

                <RealTimeSystemDestination>c:\ni-rt\VeriStand\Custom Devices\DVLMsg_Handler\DVLMsg_Handler Engine.llb\DVLMsg_Handler RT Driver VI.vi</RealTimeSystemDestination>

            </Source>

            <Source>

                <SupportedTarget>Linux_32_ARM</SupportedTarget>

                <Source>

                    <Type>To Common Doc Dir</Type>

                    <Path>\Custom Devices\DVLMsg_Handler\Linux_32_ARM\Engine LinuxARM.llb\DVLMsg_Handler RT Driver VI.vi</Path>

                </Source>

                <RealTimeSystemDestination>c:\ni-rt\VeriStand\Custom Devices\DVLMsg_Handler\Linux_32_ARM\Engine LinuxARM.llb\DVLMsg_Handler RT Driver VI.vi</RealTimeSystemDestination>

            </Source>

        </SourceDistribution>

    </CustomDeviceVI>

  <Dependencies />

  <Pages>

    <Page>

      <Name>

        <eng>DVLMsg_Handler</eng>

        <loc>DVLMsg_Handler</loc>

      </Name>

      <GUID>063b8f0b-616f-4884-bb4b-a6c55cedf529</GUID>

      <Glyph>

            <Type>To Application Data Dir</Type>

            <Path>System Explorer\Glyphs\default fpga category.png</Path>

        </Glyph>

      <Item2Launch>

        <Type>To Common Doc Dir</Type>

        <Path>Custom Devices\DVLMsg_Handler\DVLMsg_Handler Configuration.llb\DVLMsg_Handler Main Page.vi</Path>

      </Item2Launch>

    </Page>

   

  </Pages>

  <CustomXML>

    <Dummy></Dummy>

  </CustomXML>

</CustomDevice>

Member Andy-C
Member

I think the problem is an extra slash on line 33 -  sorry I didn't catch that earlier!

<Path>\Custom Devices\DVLMsg_Handler\Linux_32_ARM\Engine LinuxARM.llb\DVLMsg_Handler RT Driver VI.vi</Path>

should be

<Path>Custom Devices\DVLMsg_Handler\Linux_32_ARM\Engine LinuxARM.llb\DVLMsg_Handler RT Driver VI.vi</Path>

I saw the same error on my end at first but was able to add a custom device using your XML after making this change.

Let me know if that does the trick.

Andy

Member ARLROB
Member

I am getting closer.  Any idea why my builds are not creating the Data\NIVeriStand_DataServices.dll or Linux_32_ARM\data\NIVeriStand_DataServices.dll files? Do I need them?

Member RasmusVistisen
Member

 Hi,

I have tried to follow the guide, but I keep getting the same error, "that the custom device does not proved a valid source distribution". The xml is posted below – anyone have any input to what the problem could be?

<?xml version="1.0" encoding="utf-8"?>
<CustomDevice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Custom Device.xsd">
<XSDVersion Major="2010" Minor="0" Fix="0" Build="0" />
<AddMenu>
<eng>CSV_Logging</eng>
<loc>CSV_Logging</loc>
</AddMenu>
<Version>1.0</Version>
<Type>Asynchronous</Type>
<MaxOccurrence>2474</MaxOccurrence>
<MainPageGUID>1c2ab2dc-6ac8-45c1-9d4f-cf0e9c5ee60c</MainPageGUID>
<InitializationVI>
<Type>Action</Type>
<Item2Launch>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\CSV_Logging Configuration.llb\CSV_Logging Initialization VI.vi</Path>
</Item2Launch>
</InitializationVI>
<CustomDeviceVI>
<SourceDistribution>
<Source>
<SupportedTarget>PharlapWindows</SupportedTarget>
<Source>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\CSV_Logging Engine.llb\CSV_Logging RT Driver VI.vi</Path>
</Source>
<RealTimeSystemDestination>c:\ni-rt\VeriStand\Custom Devices\CSV_Logging\CSV_Logging Engine.llb\CSV_Logging RT Driver VI.vi</RealTimeSystemDestination>
</Source>
<Source>
<SupportedTarget>Linux_32_ARM</SupportedTarget>
<Source>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\Engine LinuxARM.llb\CSV_Logging RT Driver VI.vi</Path>
</Source>
<RealTimeSystemDestination>c:\ni-rt\VeriStand\Custom Devices\CSV_Logging\Engine LinuxARM.llb\CSV_Logging RT Driver VI.vi</RealTimeSystemDestination>
</Source>
</SourceDistribution>
</CustomDeviceVI>
<Dependencies />
<Pages>
<Page>
<Name>
<eng>CSV_Logging</eng>
<loc>CSV_Logging</loc>
</Name>
<GUID>1c2ab2dc-6ac8-45c1-9d4f-cf0e9c5ee60c</GUID>
<Glyph>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\Glyphs\File.png</Path>
</Glyph>
<Item2Launch>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\CSV_Logging Configuration.llb\CSV_Logging Main Page.vi</Path>
</Item2Launch>
</Page>
<Page>
<Name>
<eng>CfgParams</eng>
<loc>CfgParams</loc>
</Name>
<GUID>e46c92e1-b50c-481c-ac31-4724ec750dd7</GUID>
<Glyph>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\Glyphs\Cfg.png</Path>
</Glyph>
<Item2Launch>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\CSV_Logging Configuration.llb\CfgParams.vi</Path>
</Item2Launch>
</Page>
<Page>
<Name>
<eng>Signals</eng>
<loc>Signals</loc>
</Name>
<GUID>8edd8161-2f91-4e7c-869e-aaf389fda655</GUID>
<Glyph>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\Glyphs\signal.png</Path>
</Glyph>
<Item2Launch>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\CSV_Logging Configuration.llb\Signals.vi</Path>
</Item2Launch>
</Page>
<Page>
<Name>
<eng>ChnlPage</eng>
<loc>ChnlPage</loc>
</Name>
<GUID>9e85d698-d0e5-4637-9e49-7a4daac924bd</GUID>
<Glyph>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\Glyphs\channel.png</Path>
</Glyph>
<Item2Launch>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\CSV_Logging Configuration.llb\ChnlPage.vi</Path>
</Item2Launch>
</Page>
<Page>
<Name>
<eng>Extra1</eng>
<loc>Extra1</loc>
</Name>
<GUID>332dbbba-abbb-485c-8794-9b2097fb89de</GUID>
<Glyph>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\Glyphs\Boolean2.png</Path>
</Glyph>
<Item2Launch>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\CSV_Logging Configuration.llb\Extra1.vi</Path>
</Item2Launch>
</Page>
<Page>
<Name>
<eng>Extra2</eng>
<loc>Extra2</loc>
</Name>
<GUID>a556a6bb-995a-48d2-99cf-4ebabb41d282</GUID>
<Glyph>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\Glyphs\LVError.png</Path>
</Glyph>
<Item2Launch>
<Type>To Common Doc Dir</Type>
<Path>Custom Devices\CSV_Logging\CSV_Logging Configuration.llb\Extra2.vi</Path>
</Item2Launch>
</Page>
</Pages>
<CustomXML>
<Dummy></Dummy>
</CustomXML>
</CustomDevice>

Contributors