Integrator Resources

The official home for NAI Support

Not sure where to start? Try Quick Start Guide or ask a question below!

Toggle Components with Visual Button
JavaScript Form Processing

Software Development Guide

Using the NAI Software Support Kit 2.X

This guide will explain how to use the NAI Software Support Kit 2.X alongside other tools from NAI to develop your application.

If you have not already NAI recommends using the NAI Workshop to kickstart development. Via a GUI it allows users to quickly configure and operate NAI products. The CodeGenerator tool within the NAI Workshop will allow you to kickstart writing your program as it will record the API calls made as you use the GUI to configure and operate your hardware.

If you do not yet have your hardware you can still use the NAI Workshop to kickstart your development via the Demo Panel.

If you do not yet know details about your hardware and have already started using the NAI Workshop you can skip to Starting Development. If you want help setting up the environment you can simply pick your preferred OS and follow the corresponding instructions before continuing to Starting Development. The code you write will be fully portable.

To download the NAI Software Support Kit click here.

Environment Setup

These sections will explain how to setup your environment to begin development for your chosen OS. If you do not know what OS you will use yet simply pick your preferred OS, all written .c files will are fully portable.

Linux Target

Host PC

  • The recommended development platform is a PC with minimum 2GB RAM and 30GB hard drive space, and with Linux CentOS 64-bit v6.5 installed.

  • We have tested the application development environment with the above version of CentOS. Other versions of Linux may work as well but are not guaranteed.

CentOS

There are additional packages required to be installed after CentOS is installed on host PC. Type the following:

$ sudo yum install update

$ sudo yum groupinstall “Development Tools”

$ sudo yum install texi2html texinfo glibc-devel chrpath

$ sudo yum install glibc.i686 libgcc.i686 libstdc++.i686 glibc-devel.i686 ncurses-libs.i686 zlib.i686

Cross-Compiler

The current ARM target board is running on an XILINX® XC7Z015 SoC. The ARM Linux Cross-Compiler package is available on Xilinx’s website. Download the software as follows:

  1. Navigate to: https://www.xilinx.com/support/download.htmlhttps://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vivado-design-tools.htmlhttps://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vivado-design-tools.html

  2. Click on the “Embedded Development” tab.

  3. Click on “Archive” under “Version”.

  4. Select version “2017.2” under 2017. Under “Software Development Kit Standalone WebInstall Client”, download “SDK 2017.2 WebInstall for Linux 64”.

  5. You will be taken to a sign in page. If you have an account, sign in, otherwise click “Create your account.”

nai arm linux7
  1. Enter all required details and click “Create Account.”

nai arm linux8
  1. You will be e-mailed an activation message to your entered email address. Follow its instructions to activate your Xilinx account.

  2. Once your Xilinx account is created and activated, sign in. If necessary, go back to the Software Development download page and click “SDK 2017.2 WebInstall for Linux 64” once again.

  3. On the “Download Center” page that comes up, fill out all of the required fields and then press “Next”. The file should begin downloading.

P:\EMulle\xilinx2018install\windowsXilinxWebsiteSignIn.jpg
  1. Based upon the Firefox revision used, security errors may be encountered. If an error occurs, update the Firefox version installed by entering the following in the terminal, restarting the host PC, and retrying to install the SDK.

# sudo yum update firefox
  1. Go to the location the SDK file is downloaded to. Use the terminal as follows to allow the file to be executed, or right click the file, go to properties, then permissions, and check the “Allow executing file as program” box.

# cd <Directory of downloaded SDK file>

# chmod 777_ Xilinx_SDK_2017.2_0616_1_Lin64.bin
  1. Run Xilinx_SDK_2017.2_0616_1_Lin64.bin from the location it is downloaded to.

# ./Xilinx_SDK_2017.2_0616_1_Lin64.bin

Note

The Vivado 2017.2 Installation menu may prompt you to install a newer version of Vivado SDK.

DO NOT upgrade to the newer version of the SDK.

  1. Click on “Next.” image::nai_arm_linux/nai_arm_linux10.jpeg[P:\EMulle\Documentation\petaLinux\SSK\2017.2\welcomeScreen.jpg,width=555,height=382]

  2. Enter your credentials to login and click Next.

P:\EMulle\Documentation\petaLinux\SSK\2017.2\loginScreen.jpg
  1. Check all of the “I Agree” boxes and click Next.

P:\EMulle\Documentation\petaLinux\SSK\2017.2\licenseAgreements.jpg
  1. Select “Xilinx Software Development Kit (XSDK)”. image::nai_arm_linux/nai_arm_linux13.jpeg[P:\EMulle\Documentation\petaLinux\SSK\2017.2\editionSelect.jpg,width=546,height=378]

Note

You don’t need to purchase a license for the Software Development Kit (Standalone).

  1. Leave the defaults checked and click Next. DocNav can be unchecked if not needed or disk space needs to be conserved.

P:\EMulle\Documentation\petaLinux\SSK\2017.2\installerScreen.jpg
  1. Choose your desired installation directory and click Next.

P:\EMulle\Documentation\petaLinux\SSK\2017.2\directorySelect.jpg
  1. Make sure all options chosen are correct and click Install.

P:\EMulle\Documentation\petaLinux\SSK\2017.2\installSummary.jpg
  1. Once the installation is complete, click “OK.”

P:\EMulle\Documentation\petaLinux\SSK\2017.2\installationComplete.jpg
VxWorks Target

Configure the Board Library

Due to the portable nature of the NAI Software Support Kit some configuration is necessary to specify information about your target. If the information changes simply reconfigure the project, the code you have developed will be reuseable.

The NAI Board Software Support Kit (SSK) libraries need to be added to the VxWorks project and built for the SBC that they will be run on. There are three files that need to be modified before the project is built. Two of the files are located in the naibrd/include/advanced directory and one in the naibrd/src directory.

The file naibrd_config.h (located in naibrd\src) is used to determine how the NAI Board libraries will be configured. The files nai_pci_vxworks_adv.h and nai_vme_vxworks_adv.h (located in naibrd\include\advanced) determine how NAI Board will interface with the SBC hardware.

The following table shows which definitions need to be included or excluded for each of the NAI Single Board Computers currently available.

21
22

NAI 64PPC1 SBC Example of naibrd_config.h

/* Define if running on ARM Processor and a Xilinx FPGA (i.e. 64ARM1, 99ARM1, NIU1A) */
/* #define ARM_XILINX */
/* Define if running on PPC Processor and a Xilinx FPGA (i.e. 75PPC1, 64PPC1) */
#define PPC_XILINX
/* Define if running on Intel Processor and a Xilinx FPGA (i.e. 75INT2) */
/* #define INTEL_XILINX */
/* Define if running on PPC Processor and a Altera FPGA (i.e. legacy 75PPC1) */
/* #define PPC_ALTERA */
/* Define for Gen 5 processors */
#define NAI_GEN5_GENUSE_SIZE 0x4000u
#if defined(__VXWORKS__)
 #if defined(ARM_XILINX)
 #define GEN5_ARM
 #elif defined(INTEL_XILINX)
 #define GEN5_INTEL
 #elif defined(PPC_XILINX) || defined(PPC_ALTERA)
 #define GEN5_PPC
 #endif
#endif
#if defined(LINUX)
 #if defined(LINUX_ARM)
 #define GEN5_ARM
 #else
 #define GEN5_INTEL
 #endif
#endif
#if defined (WIN32) || defined(LINUX) || defined(__VXWORKS__) || defined(__INTEGRITY)
 /* Enables Ethernet communication support */
 #define NAI_USE_INTF_ETHER
#endif
#if defined (WIN32) || defined(LINUX) || defined(PROC_U2) || defined(__VXWORKS__) || defined(__INTEGRITY)
 /* Enables PCI/CPCI/PCI Express support */
 #define NAI_USE_INTF_PCI /* 75PPC1, 75INT2, 64PPC1 (on board has PCIe) */
 /* Enables VME support */
 #define NAI_USE_INTF_VME /* 64ARM1, 64PPC1 */
#endif

NAI 64PPC1 SBC Example of nai_pci_vxworks_adv.h

/*******************************************************************************************/
/* This section must be defined for the particular SBC that the Library will be running on */
/*******************************************************************************************/
#define NAI_BSP_NAI64PPC1
/* Only ONE of these definitions should be define
#define NAI_BSP_NAI75PPC1
#define NAI_BSP_NAI64PPC1
#define NAI_BSP_GE_SBC610
#define USER_BSP_PCI // Search for this value and add appropriate code for PCI/PCIe SBC being used
*/
#ifdef NAI_BSP_NAI75PPC1 /* NAI 75PPC1 SBC */
/*
* The NAI 75PPC1 only supports vxBus
* The NAI 75SBC4 does not have a rear connector
* PCI Interface but requires PCI be defined,
* so the NAI 75PPC1 setting are used.
*/
#define NAI_BSP_CPCI75PPC1
#define NAI_ENDIAN_SWAP /* PPC is Big Endian */
#define VXB_PCI_ENABLE /* VxBus PCI supported */
#define VXB_DEVICE_NAME "QorIQPciEx" /* VxBus Driver Name (from vxBusShow) */
#define NAI_SBC_DEVID 0x7584 /* Card PCI Device ID */
#endif
#ifdef NAI_BSP_NAI64PPC1 /* NAI 64PPC1 SBC */
/*
* The NAI 64PPC1 is a VME SBC but it uses PCIe
* for onboard access, so it requires PCI be defined.
*/
#define NAI_BSP_VME64PPC1
#define NAI_ENDIAN_SWAP /* PPC is Big Endian */
#define VXB_PCI_ENABLE /* VxBus PCI supported */
#define VXB_DEVICE_NAME "QorIQPciEx" /* VxBus Driver Name (from vxBusShow) */
#define NAI_SBC_DEVID 0x6484 /* Card PCI Device ID */
#endif
/*
* GE VPX SBC610 SBC
*/
#ifdef NAI_BSP_GE_SBC610
#define GE_BSP_SBC610
#define NAI_ENDIAN_SWAP
#define VXB_PCI_ENABLE
#define VXB_DEVICE_NAME "m85xxPci" /* VxBus Driver Name (from vxBusShow) */
#endif
/*
* USER PCI SBC
*/
#ifdef USER_BSP_PCI
#define USER_BSP_PCI_SBC /* SBC type/name */
#define NAI_ENDIAN_SWAP /* PPC is Big Endian, Intel & ARM is Little Endian */
#define VXB_PCI_ENABLE /* VxBus PCI supported */
#define VXB_DEVICE_NAME "xxxxxPci" /* VxBus Driver Name (from vxBusShow) */
#endif

NAI 64PPC1 SBC Example of nai_vme_vxworks_adv.h

/*******************************************************************************************/
/* This section must be defined for the particular SBC that the Library will be running on */
/*******************************************************************************************/
#define NAI_BSP_NAI64PPC1
/* Only ONE of these definitions should be define
#define NAI_BSP_NAI64PPC1
#define NAI_BSP_NAI64ARM1
#define MOT_BSP_MV6100
#define USER_BSP_VME // Search for this value and add appropriate code for VME SBC being used
*/
#ifdef NAI_BSP_NAI64PPC1 /* NAI VME 64PPC1 SBC */
/*
* The NAI 64PPC1 uses PCIe for onboard
*/
#define NAI_BSP_VME64PPC1
#define NAI_ENDIAN_SWAP /* PPC is Big Endian */
#define VXB_VME_ENABLE /* VxBus VME supported */
#define NAI_SBC_DEVID 0x6484 /* Card Device ID */
#endif
/*
* NAI VME 64ARM1 SBC
*/
#ifdef NAI_BSP_NAI64ARM1
#define NAI_BSP_VME64ARM1
// #define NAI_ENDIAN_SWAP /* ARM is Little Endian */
#define VXB_VME_ENABLE /* VxBus VME supported */
#define NAI_SBC_DEVID 0x6481 /* Card Device ID */
#endif
/*
* Motorola MV6100 SBC
*/
#ifdef MOT_BSP_MV6100
#define MOT_BSP_VME_MV6100
#define NAI_ENDIAN_SWAP
// #define VXB_VME_ENABLE /* VxBus VME supported */
#endif
/*
* USER VME SBC
*/
#ifdef USER_BSP_VME
#define USER_BSP_VME_SBC /* SBC type/name */
#define NAI_ENDIAN_SWAP /* PPC is Big Endian, Intel & ARM is Little Endian */
#define VXB_VME_ENABLE /* VxBus VME supported */
#endif

Non NAI Single Board Computer Software Modifications

PCI/CPCI/PCIe

If NAI Board is running on a non NAI SBC, there are a couple of files that will need to be modified for the libraries to work correctly. If the backplane interface is PCI, CPCI or PCIe, the files nai_pci_vxworks.h and nai_pci_vxworks.c will need to be modified.

At the top of the nai_pci_vxworks.h file the definition USER_BSP_PCI needs to be defined.

#define USER_BSP_PC1
/* Only ONE of these definitions should be define
#define NAI_BSP_NAI75PPC1
#define NAI_BSP_NAI64PPC1
#define NAI_BSP_GE_SBC610
#define USER_BSP_PCI // Search for this value and add appropriate code for PCI/PCIe SBC being used
*/

In the section where the USER_BSP_PCI definition are declared, the appropriate #defines will need to be included based on the SBC.

/*
* USER PCI SBC
*/
#ifdef USER_BSP_PCI
#define USER_BSP_PCI_SBC /* SBC type/name */
#define NAI_ENDIAN_SWAP /* PPC is Big Endian, Intel & ARM are Little Endian */
#define VXB_PCI_ENABLE /* VxBus PCI supported */
#define VXB_DEVICE_NAME "xxxxxPci" /* VxBus Driver Name (from vxBusShow) */
#endif

#define USER_BSP_PCI_SBC This can be left as is or can be renamed to better reflect the SBC type that the library is running on. If it is changed, a global search and replaced should be performed.

#define NAI_ENDIAN_SWAP This should be defined if the library is running on a Big Endian processor such as a PPC. If the library is running on a Little Endian processor such as an ARM or Intel, this should not be defined

#define VXB_PCI_ENABLE This should be defined if the library is running on a processor that has a vxBus driver for PCI/PCIe. If not, this should not be defined.

#define VXB_DEVICE_NAME " QorIQPciEx " If a vxBus driver is available, this should be updated to the appropriate driver name. The driver name can be obtained by running the vxBusShow command from the shell. Search the output for the PCI drive name.

-> vxBusShow
Registered Bus Types:
 USB-EHCI_Bus @ 0x0903b340
 USB-Host_Bus @ 0x003c74c4
 USB-HUB_Bus @ 0x003c74a8
 MII_Bus @ 0x003bfa64
 PCI_Bus @ 0x003bf6d4
 PLB_Bus @ 0x003bf6f0
Registered Device Drivers:
 vxbUsbBulkClass at 0x0903b480 on bus USB-HUB_Bus, funcs @ 0x003c748c
 vxbUsbHubClass at 0x003d36c0 on bus USB-HUB_Bus, funcs @ 0x003c748c
 :
 :
 QorIQQman at 0x003bebfc on bus PLB_Bus, funcs @ 0x003bebd8
 QorIQPciEx at 0x003be7d8 on bus PLB_Bus, funcs @ 0x003be75c
 QorIQBman at 0x003beac0 on bus PLB_Bus, funcs @ 0x003beaa4
 QorIQLaw at 0x003beb98 on bus PLB_Bus, funcs @ 0x003beb5c
 openPicTimer at 0x003bedf8 on bus PLB_Bus, funcs @ 0x003bedd4
 plbCtlr at 0x003bf718 on bus PLB_Bus, funcs @ 0x003bf70c
Busses and Devices Present:
 PLB_Bus @ 0x003db1b0 with bridge @ 0x003bf758
 Device Instances:
 ppcIntCtlr unit 0 on PLB_Bus @ 0x003dc170 with busInfo 0x00000000
 epic unit 0 on PLB_Bus @ 0x003dc270 with busInfo 0x00000000
 :
 :
 QorIQLaw unit 0 on PLB_Bus @ 0x003dcc70 with busInfo 0x0
 QorIQBman unit 0 on PLB_Bus @ 0x003dcd70 with busInfo 0x00000000
 QorIQQman unit 0 on PLB_Bus @ 0x003dce70 with busInfo 0x00000000
 QorIQFman unit 0 on PLB_Bus @ 0x003dcf70 with busInfo 0x00000000
 QorIQPciEx unit 0 on PLB_Bus @ 0x003dd070 with busInfo 0x00000000
 vxbPlbUsbEhci unit 1 on PLB_Bus @ 0x003ebc70 with busInfo 0x003ef270

nai_pci_vxworks.c Modifications In the file nai_pci_vxworks.c, there are two functions that will need to the modified. The first function is:

STATUS naiPciVxInstallISR(int32_t cardIndex, nai_isr_t isr, void* param)

This will need to be modified to install and enable an Interrupt Service Routine on your SBC. This can sometimes be very BSP specific and you may need to contact your SBC Vendor for help. You can use the code supplied for the NAI SBC as a starting point.

The second function is:

STATUS naiPciVxUninstallISR(int32_t cardIndex, nai_isr_t isr)

This will need to be modified to uninstall and disable an Interrupt Service Routine on your SBC. This can sometimes be very BSP specific and you may need to contact your SBC Vendor for help. You can use the code supplied for the NAI SBC as a starting point.

VME

If the backplane interface is VME, the files nai_vme_vxworks_adv.h and nai_vme_vxworks.c will need to be modified. At the top of the nai_vme_vxworks_adv.h file the definition USER_BSP_VME needs to be defined.

#define USER_BSP_VME
/* Only ONE of these definitions should be define
#define NAI_BSP_NAI64PPC1
#define NAI_BSP_NAI64ARM1
#define MOT_BSP_MV6100
#define USER_BSP_VME // Search for this value and add appropriate code for VME SBC being used
*/

In the section where the USER_BSP_VME definition are declared, the appropriate #defines will need to be included based on the SBC.

/*
* USER VME SBC
*/
#ifdef USER_BSP_VME
#define USER_BSP_VME_SBC /* SBC type/name */
#define NAI_ENDIAN_SWAP /* PPC is Big Endian, Intel & ARM are Little Endian */
#define VXB_VME_ENABLE /* VxBus VME supported */
#endif

#define USER_BSP_VME_SBC This can be left as is or can be renamed to better reflect the SBC type that the library is running on. If it is changed, a global search and replaced should be performed.

#define NAI_ENDIAN_SWAP This should be defined if the library is running on a Big Endian processor such as a PPC. If the library is running on a Little Endian processor such as an ARM or Intel, this should not be defined

#define VXB_VME_ENABLE This should be defined if the library is running on a processor that has a vxBus driver for VME. If not, this should not be defined.

nai_vme_vxworks.c Modifications

In the file nai_vme_vxworks.c, there are three functions that will need to the modified. The first function is:

STATUS naiVmeVxInstallISR(int32_t cardIndex, nai_isr_t isr, void* param)

This will need to be modified to install and enable an Interrupt Service Routine on your SBC. This can sometimes be very BSP specific and you may need to contact your SBC Vendor for help. You can use the code supplied for the NAI SBC as a starting point.

The second function is:

STATUS naiVmeVxUninstallISR(int32_t cardIndex, nai_isr_t isr)

This will need to be modified to uninstall and disable an Interrupt Service Routine on your SBC. This can sometimes be very BSP specific and you may need to contact your SBC Vendor for help. You can use the code supplied for the NAI SBC as a starting point.

The third function is:

nai_status_t naiVmeVxList(int32_t count, int32_t* numCardsFound, int32_t nSlot[],
 int8_t sCardName[][16], uint32_t unVmeStartAddr[], uint32_t unVmeEndAddr[],
 uint32_t unVmeAddrMod[])

This function is used to identify all of the cards on the VME bus. By default the information is read from the table naiSlvWindows[NAI_VME_MAX_SLOT] located at the top of the file. This table will need to be updated to reflect your system configuration.

A typical system configuration might look like the following:

/*
 * This table is used for non NAI SBCs to describe the system configuration
 * Enter information for each board in the chassis
 */
nai_slv_window_t naiSlvWindows[NAI_VME_MAX_SLOT] = {
 /* Slot Num Slot Occupied Card name AM Begin VME addr End VME addr */
 { 1, TRUE, "MV6100", 0xD, 0x00000000, 0x00800000-1},
 { 2, TRUE, "64C3", 0xD, 0x08200000, 0x08300000-1},
 { 3, TRUE, "64ARM1", 0xD, 0x09000000, 0x09800000-1},
 { 4, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 5, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 6, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 7, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 8, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 9, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 10, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 11, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 12, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 13, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 14, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 15, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 16, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 17, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 18, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 19, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 20, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF},
 { 21, FALSE, "", 0xD, 0xFFFFFFFF, 0xFFFFFFFF}
};

=== Dual Port Ethernet Module

The EM1 Dual Port Ethernet Module is installed in module position 1 on the NAI PPC SBC card (i.e. 75PPC1). The Ethernet driver needs to be added to VxWorks for proper operation.

Adding EM1 Driver to the VxWorks Image

In Workbench, open the VxWorks Image Project for the processor, then open the Kernel Configuration tool.

23

Search for INCLUDE_GEI825XX_VXB_END

24

Include “INCLUDE_GEI825XX_VXB_END” in the configuration, and then rebuild the VxWork Image.

25

Load the new VxWorks Image on the processor. The two Ethernet port will now be available as gei0 and gei1.

Enabling the EM1 Ethernet Ports

To enable the Ethernet ports, the VxWorks commands ipAttach and ifconfig are used.

ipAttach (X,"gei") X = device (0 or 1) ifconfig ("geiX AAA.AAA.AAA.AAA netmask MMM. MMM. MMM. MMM up") X = device (0 or 1) AAA = IP Address MMM = subnet mask

-> ipAttach (0,"gei")
value = 0 = 0x0
-> ifconfig ("gei0 192.168.2.16 netmask 255.255.255.0 up")
value = 0 = 0x0
-> ipAttach (1,"gei")
value = 0 = 0x0
-> ifconfig ("gei1 10.0.8.123 netmask 255.0.0.0 up")
value = 0 = 0x0
-> ifconfig
lo0 Link type:Local loopback Queue:none
 inet 127.0.0.1 mask 255.255.255.255
 inet6 unicast fe80::1%lo0 prefixlen 64 automatic
 inet6 unicast ::1 prefixlen 128
 UP RUNNING LOOPBACK MULTICAST NOARP ALLMULTI
 MTU:1500 metric:1 VR:0 ifindex:1
 RX packets:3 mcast:3 errors:0 dropped:0
 TX packets:3 mcast:3 errors:0
 collisions:0 unsupported proto:0
 RX bytes:168 TX bytes:168

dtsec3 Link type:Ethernet HWaddr 00:16:c6:fe:dd:20 Queue:none
 inet 192.168.1.116 mask 255.255.255.0 broadcast 192.168.1.255
 inet6 unicast fe80::216:c6ff:fefe:dd20%dtsec3 prefixlen 64 automatic
 UP RUNNING SIMPLEX BROADCAST MULTICAST
 MTU:1500 metric:1 VR:0 ifindex:2
 RX packets:423 mcast:0 errors:0 dropped:0
 TX packets:149 mcast:8 errors:0
 collisions:0 unsupported proto:0
 RX bytes:28k TX bytes:9090

gei0 Link type:Ethernet HWaddr 00:a0:c9:00:00:02 Queue:none
 capabilities: TXCSUM TX6CSUM
 inet 192.168.2.16 mask 255.255.255.0 broadcast 192.168.2.255
 inet6 unicast fe80::2a0:c9ff:fe00:2%gei0 prefixlen 64 automatic
 UP RUNNING SIMPLEX BROADCAST MULTICAST
 MTU:1500 metric:1 VR:0 ifindex:3
 RX packets:294 mcast:0 errors:0 dropped:0
 TX packets:103 mcast:8 errors:0
 collisions:0 unsupported proto:0
 RX bytes:20k TX bytes:6330

gei1 Link type:Ethernet HWaddr 00:a0:c9:00:00:03 Queue:none
 capabilities: TXCSUM TX6CSUM
 inet 10.0.8.123 mask 255.0.0.0 broadcast 10.255.255.255
 inet6 unicast fe80::2a0:c9ff:fe00:3%gei1 prefixlen 64 tentative automatic
 UP SIMPLEX BROADCAST MULTICAST
 MTU:1500 metric:1 VR:0 ifindex:4
 RX packets:0 mcast:0 errors:0 dropped:0
 TX packets:0 mcast:0 errors:0
 collisions:0 unsupported proto:0
 RX bytes:0 TX bytes:0
value = 0 = 0x0

Building a Sample Project

This sample project is being built for a NAI 64PPC1 SBC, it will also work for other NAI PPC based SBCs. To build the project for an ARM processor SBC such as the NAI 64ARM1, some of the build parameters will be different and they will be noted where applicable.

Creating a Project in Workbench

Once Workbench has started, create a new project by selecting the menu option “File”, “New”, “Project”. In the New Project window, expand the VxWorks6.x line by clicking the arrow (►) and select “VxWorks Downloadable Kernel Module Project”. Click the Next button.

1

Enter a name for the project, for this sample we will use NAI_Board_Sample_Program.

2

Click the “Next” button until you get to the “Build Specs” window. Click “Deselect All”, then scroll down the list of available build specs and select “PPC32diab” (“ARMARCH7diab” for an ARM processor) for single core. To build for SMP select “PPC32diab_SMP” (“ARMARCH7diab_SMP” for an ARM processor). Click “Finish”.

3

The project will now appear in the Project Explorer window of Workbench.

4

Importing NAI Board SSK Files into a Project

To import the SSK files into the project, right click on the NAI_Board_Sample_Program entry in the Project Explorer window, and then select “Import”. In the Import Window, select “General”, “File System”, then click “Next”.

5

Navigate to NAI Board SSK directory (CDROM). From the base directory, select the naibrd and AppSrc sub directories. This will include the Library and sample programs in the project. Click the “Finish” button.

6

The NAI Board library and Sample Source files are now included in the project.

7

You will need to configure the NAI Board Library for the Single Board Computer that it will be running on. To do this, refer to the Configure the NAI Board Library for a Specific SBC section in this document.

Building a Project

To build the project, select on the menu, “Project”, “Build Project”. The first time the project is built, the include paths will need to be generated. Workbench will automatically add the paths for you, click the “Generate Includes…​” button.

8

When the “Analyses Include directives” windows appears, click “Next”

9

When the “Resolve include directives” window appears, click “Resolve All”.

10

If the “Resolve Ambiguous Include Directives” appears, click “OK”.

11

The include paths will be added to the project.

12

Click the “Next” button.

13

Verify that the “PPC32diab” (“ARMARCH7diab” for an ARM processor) build spec is selected and click “Finish”. The project is now ready to be built. From the menu select “Project”, Build Project”, the project will be built and a NAI_Board_SampleProject.out file will be created.

14
15
DeOS Target

Choose your favorite IDE to develop C programs with and open the Software Support Kit.

Starting Development

If you have not already NAI recommends using the NAI Workshop to kickstart development. Via a GUI it allows users to quickly configure and operate NAI products. The CodeGenerator tool within the NAI Workshop will allow you to kickstart writing your program as it will generate and save the API calls you make via the GUI as you configure and operate your hardware.

Now that your enviroment is set up and your project has been configured according to your hardware you can begin development. If you do not know yet what hardware you will be using you can begin development now and go through configuration later. The development process is universal for all configurations.

For development we will be using the NAI Software Support Kit.

NAI recommends that you begin with our selection of sample applications. The full collection can be found here.

First select a sample application from the family that you wish to develop for. For the sake of example we will use the discrete I/O family. The particular file we are using is DT_BasicOps.c

While the precise functionality is specific to the discrete I/O family, most sample applications use a similar structure.

For more generic board level functionality NAI offers guides on interrupts, watchdog timers, NAI ethernet protocols, BIT, multicore applications, and backplane reset.

Setup Menu

While reading this section please read along in the source code here at the same time to best understand how to then develop your own application.

Once you run the sample application you will be presented with a configuration menu. The first question will ask what your system is.

  • Nano

A Nano unit is a small, rugged multifunction I/O system.

nano NIU2A NIU1A

  • SIU

An SIU is a large rugged system containing multiple open backplane boards.

siu SIU34 SIU32S

  • Board

A board is a single board computer.

image1

In this example we are using a board so we input B. We then selected the board we were using, a 75G5.

image2

To connect you then must enter what ethernet protocol you are using, your type of ethernet port, and the IP address of the board.

image3

If all of the above information was correct you will then connect to the board and see the following configuration menu.

Please then select which module you would like to configure.

image4

We then selected which channel we would like configure and the following configuration menu opened, containing all of the settings to configure the module’s channel.

image5

As an example we then selected DT Set Lower Threshold Voltage and made our configuration change.

image6

With this sample application as the basis please refer to other sample applications for more information.

While this sample application was a configuration app there are also specific examples of how to use features of a given module.

For example if you want to implement ethernet IDR with discrete I/O NAI offers a corresponding sample application.

For more generic board level functionality NAI offers guides on interrupts, watchdog timers, NAI ethernet protocols, BIT, multicore applications, and backplane reset.

Once you have completed your application and want to test it it is time to build and export your program.

Connecting to the System

To learn how to get connected via the Software Support Kit please click here.

To set up a remote serial and ethernet connection please follow the following steps.

Remote Connection

The serial connection and Ethernet port are accessed through the HDMI connector on ARM target boards. For ruggedized ARM enclosures, both ports are routed to a MIL connector. You may need an external adapter board (see below) to convert the HDMI connector to a serial and Ethernet port.

CAUTION

Ensure that target board is powered off, until directed to power it on.

extracted-media/media/image1
extracted-media/media/image2
HDMI Connector MIL Connector

Note

The USB-A connector on the adapter board is not supported by the ARM target board.

extracted-media/media/image3

Adapter Board

Serial Port

  1. 1. Install minicom through the terminal:

$ sudo yum install minicom

2. Check for all available serial ports:

$ dmesg | grep tty

3. Run minicom with the desired serial port.

$ sudo minicom -s /dev/<Serial Port>

4. Select 'Serial port setup'

M:\untitled folder 2\figure1.png

5. Set Serial Device to the serial port name found by using the dmesg | grep tty command. Leave Calling Program and Callout Program empty. Set Bps/Par/Bits to 115200 8N1. Set Hardware Flow Control to 'No'. Set 'Software Flow Control to 'No'. Next to 'Change which setting?' type in the letter of the setting that will be altered. Press 'Enter' to exit 'Serial port settings'

6. Select 'Save setup as _dev_ttyUSB0' in the main configuration menu.

M:\untitled folder 2\figure2.png

7. Select 'Modem and dialing' in the main configuration menu.

8. Every setting from A to H should be empty.

M:\untitled folder 2\figure3.png

9. Select 'Exit' and then Power Cycle the board.

Ethernet Port

  1. Connect the Ethernet port from target board and Host PC to a local network.

  2. Open shell terminal on Host PC and type the following command:

ssh root@<IP address of the target board>

Note

The default IP address of the target board is available on the label or it can be obtained by running the ifconfig command from shell terminal.

Changing the Ethernet IP Addresses

The target board contains 2 Ethernet Interfaces. Each Ethernet Interface is assigned a unique MAC address and static IP address. The MAC addresses and static IP addresses are stored on the motherboard EEPROM. The static IP address can be changed using an EEPROM update utility provided with the unit. The MAC addresses should not be changed.

To access the EEPROM utility from the Linux shell terminal, proceed as follows:

  1. Log in as a root user to the target board. The default password is root.

  2. Display the contents of the motherboard EEPROM by typing:

mbeeprom_util display

  1. The following or something similar (your model may vary) displays:

root@nai-niu1a:~# mbeeprom_util display

NAI ARM-SOC Motherboard EEPROM Utility (mbeeprom_util)

Target Processor: Xilinx ARM

Target OS: PetaLinux

Build Revision: 3.32.3

Build Date: Oct 29 2014 08:26:22 UTC


Displaying Motherboard EEPROM - Start

00000000: 4E 4F 4E 45 :NONE:

00000004: 32 33 31 34 :2314:

00000008: 42 4F 4F 31 :BOO1:

0000000C: 00 00 00 00 ::

00000010: 04 00 00 00 ::

00000014: 00 00 00 00 ::

00000018: 4E 49 55 00 :NIU:

0000001C: 31 41 00 00 :1A:

00000020: 01 00 02 00 ::

00000024: 01 00 02 00 ::

00000028: AA BB CC DD :ª»ÌÝ:

0000002C: EE FF 00 00 :îÿ:

00000030: 65 74 68 30 :eth0:

00000034: 00 00 00 00 ::

00000038: C0 A8 01 10 :ˬ:

0000003C: FF FF FF 00 :ÿÿÿ:

00000040: C0 A8 01 01 :ˬ:

00000044: 20 02 C0 A8 : ˬ:

00000048: 01 01 00 00 ::

0000004C: 7C 99 D1 18 :\|Ñ:

00000050: 90 58 12 35 :X5:

00000054: 40 00 00 00 :@:

00000058: 11 22 33 44 :"3D:

0000005C: 55 66 00 00 :Uf:

00000060: 65 74 68 31 :eth1:

00000064: 00 00 00 00 ::

00000068: C0 A8 02 10 :ˬ:

0000006C: FF FF FF 00 :ÿÿÿ:

00000070: C0 A8 02 01 :ˬ:

00000074: 20 02 C0 A8 : ˬ:

00000078: 01 02 00 00 ::

0000007C: 7C 99 D1 18 :\|Ñ:

00000080: 90 58 12 35 :X5:

00000084: 30 00 00 00 :0:

00000088: 00 0F 00 00 ::

0000008C: 00 00 00 00 ::

00000090: 00 00 00 00 ::

00000094: 41 CE 42 CE :AÎBÎ:

00000098: 41 CE 42 CE :AÎBÎ:

0000009C: E6 CD E7 CD :æÍçÍ:

000000A0: F0 CD F1 CD :ðÍñÍ:

000000A4: 00 00 00 00 ::

000000A8: 00 00 00 00 ::

000000AC: 00 00 00 00 ::

000000B0: 00 00 00 00 ::

000000B4: 00 00 00 00 ::

000000B8: 00 00 00 00 ::

000000BC: 00 00 00 00 ::

000000C0: 00 00 00 00 ::

000000C4: 00 00 00 00 ::

000000C8: 00 00 00 00 ::

000000CC: 00 00 00 00 ::

000000D0: 00 00 00 00 ::

000000D4: 00 00 00 00 ::

000000D8: 00 00 00 00 ::

000000DC: 00 00 00 00 ::

000000E0: 00 00 00 00 ::

000000E4: 00 00 00 00 ::

000000E8: 00 00 00 00 ::

000000EC: 00 00 00 00 ::

000000F0: 00 00 00 00 ::

000000F4: 00 00 00 00 ::

000000F8: 00 00 00 00 ::

000000FC: 00 00 00 00 ::

Displaying Motherboard EEPROM – Start

The Eth-0 IP Address is stored at EEPROM address 00000038: C0 A8 01 10 (192.168.1.16)

The Eth-1 IP Address is stored at EEPROM address 00000068: C0 A8 02 10 (192.168.2.16)

To update the static IP addresses, enter the following commands (substitute your desired IP addresses):

root@nai-niu1a:~/NAII# mbeeprom_util set EthA_IPv4Address 192.168.1.16

root@nai-niu1a:~/NAII# mbeeprom_util set EthA_IPv4SubnetMask 255.255.255.0

root@nai-niu1a:~/NAII# mbeeprom_util set EthB_IPv4Address 192.168.2.16

root@nai-niu1a:~/NAII# mbeeprom_util set EthB_IPv4SubnetMask 255.255.255.0

The updated IP addresses will take effect on the next system reset.

CAUTION

The mbeeprom_util program will allow you to erase the entire contents of the EEPROM. DO NOT do this as it will erase important system parameters including the Ether Interface MAC addresses. The ARM board will not function without these settings.

DO NOT alter any of the other EEPROM fields as the ARM board will not function without the correct settings.

Building and Running a Project

Linux

Building NAI_SSK_LINUX ARM Library

NAI provides a pre-built library and source code. You can also rebuild the library on your Host PC.

Note

The Cross-Compiler and PATH must be configured on Host PC as detailed previously.

  1. Copy NAI SSK Library and Sample Application package to Host PC.

  2. Build NAI SSK Library on Host PC to generate a (libnaibrd.so) file as follows:

$ cd <directory of NAI SSK on host PC>/Libraries/naibrd

$ make clean NAI_TARGET_BOARD_TYPE=arm

$ make all NAI_TARGET_BOARD_TYPE=arm
  1. Verify the library ELF binary is an ARM version:

$ file libnaibrd.so

libnaibrd.so: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, not stripped
  1. Copy NAI library (.so) to <directory of NAI SSK on host PC >/Lib/Linux_ARM. NAI sample application MakeFile will link with the library (.so) file in /Lib/Linux_ARM folder.

Building an NAI Sample Application

NAI provides prebuilt sample application and source code. You can also rebuild the sample application on your host PC.

Prerequisite: Pre-built NAI SSK Library including the following:

  • <directory of NAI SSK on host PC>/Lib/Linux_ARM

  • <directory of NAI SSK on host PC>/include

Build the sample application as follows:

  1. Copy NAI SSK Library and Sample Application package to Host PC

  2. Build NAI SSK sample application on Host PC, the MakeFile will build all the sample applications in /AppSrc

$ cd <directory of NAI SSK on host PC>/AppSrc

$ make clean NAI_TARGET_BOARD_TYPE=arm

$ make all NAI_TARGET_BOARD_TYPE=arm

Running NAI Sample Application and NAI Library on the ARM Board

  1. Upload the NAI Library to /usr/lib in the target board from Host PC.

$ cd <directory of NAI SSK on host PC>/Lib/Linux_ARM

$ scp libnaibrd.so root@<IP address of target board>:/usr/lib
  1. Run NAI Sample Application on the target board:

Choose an executable ELF from <directory of NAI SSK on host PC>/App and upload to the target board as follows, then run it.

$ scp <directory of NAI SSK on host PC>/App/Linux_ARM/<sample app> root@<IP address of target board>:/var/ftp

$ ssh root@<IP address of target board>

# cd <directory of the sample app>

# ./<sample app>
Petalinux

Importing and Building Sample Applications

  1. Run Xilinx SDk 2018.2 and select the following folder from the NAI library package as your workspace:

    • PACKAGE_LOCATION\petalinux-2018-2\petalinux-appsrc

pl1
  1. If there are already projects when you load the workspace, Select them all, right click, and Delete them. Do NOT select "Delete project contents on disk".

pl2
  1. Import NAI projects by selecting File→Import→Existing Projects into Workspace from the Xilinx SDK toolbar:

pl3
  1. Select Next and then select the workspace directory as the root directory:

    • PACKAGE_LOCATION\petalinux-2018-2\petalinux-appsrc

pl4
  1. Select finish to add NAI libraries and sample code projects to the workspace.

    • If you get this error, simply X it out and X out the Import window.

pl5
  • Your Project Explorer should now look similar to this:

pl6
  1. Navigate to Project at the top of Xilinx and make sure Build automatically is unchecked.

  2. Select Window→Preferences from the Xilinx toolbar and set the Indexer to "Use active build configuration" and select OK.

pl7
  1. Select all of the projects, right click, click Build Configurations, Set Active, Debug-Ultrascale/Zynq-. (pick the configuration (Zynq/Ultrascale) and the board you have, ex. NIU3A)

pl8
  1. Select all of the library projects (nai_bsp projects, nai_libs projects, naiapp_common) and right click Clean Project then right click Build Project.

pl9
  1. Select a module sample project to Clean then Build which will generate an elf executable that can be run on the processor board.

pl10
VxWorks

Building a Project

To build the project, select on the menu, “Project”, “Build Project”. The first time the project is built, the include paths will need to be generated. Workbench will automatically add the paths for you, click the “Generate Includes…​” button.

8

When the “Analyses Include directives” windows appears, click “Next”

9

When the “Resolve include directives” window appears, click “Resolve All”.

10

If the “Resolve Ambiguous Include Directives” appears, click “OK”.

11

The include paths will be added to the project.

12

Click the “Next” button.

13

Verify that the “PPC32diab” (“ARMARCH7diab” for an ARM processor) build spec is selected and click “Finish”. The project is now ready to be built. From the menu select “Project”, Build Project”, the project will be built and a NAI_Board_SampleProject.out file will be created.

14
15

Creating a Target Remote Server

A target server connection is needed to download and debug your application program.

From the menu select “Target”, “New Connection. Highlight “Wind River VxWorks 6.x Target Server Connection”, and then click Next.

16

Enter the IP address of the SBC and the location of the VxWorks Image that was downloaded to the SBC.

17

Click the next button until you get to the Connection Summary window. Enter a Connection name for your target server and click finished.

18

Your new Target Server connection will appear in the Remote System tab in your Workbench project. Highlight the server, right click and select “Connect”

19

Downloading Application to the Single Board Computer (SBC)

The Sample application file can now be downloaded and run on the processor.

From the Menu select “Run”,”Download”,”Download”,”VxWorks Kernal Task”

20

Select “NAI_Board_Sample_Sample_Project.out”, the appropriate target processor, and click “Download”. You can now run any of the provided sample applications from the Shell.

DeOS

Building Deos BSP Package in OpenArbor

  • Launch OpenArbor

  • Select the deos/deos_kismet/nai-ultrascale directory in the location of the SSK

    workspace
  • Once the workspace has been selected, the following projects should be made available to build in the DDCI-Project Window. (Projects may vary depending on system configuration)

    projects
  • Building the nai-ultrascale platform project will generate a composite.darc file which contains the kernel, configuration files and application code that will be loaded onto the target system

    composite
  • Refer to the file uboot_env_vars.md for U-Boot environment variables that need to be set to net-boot Deos on a given platform

Running Other Sample Applications in OpenArbor

By default, the only dependency that the nai-ultrascale platform project has is the Deos standard-apps which enable network connection to run tools like the Video Stream and Status Monitor. To run any of the included NAI sample applications, you can add the application as a dependency on the platform project. The Deos image need to be rebuilt and reloaded.

  • Go to the platform project nai-ultrascale and navigate to Deos Component -> Dependencies. Right-click and select Add Dependency

    dependency
  • Select the application you would like to integrate with the nai-ultrascale BSP

    edit
  • Build all projects

  • In the Target Manager add a connection for the nai-ultrascale platform project

  • Launch the Status Monitor or the Video Stream

  • Right-click the Status Monitor or Video Stream and click Update Target Load Make sure End up in registry is set to platreg if that is where application dependency is. Make sure Force Cold Start is checked

  • Deos should now cold start and the new application should be running

Changing Board IP Address

  • Change the IP address in u-boot via the ipaddr environment variable. Make sure to save the environment via the saveenv command:

    setenv ipaddr 192.168.1.16
    setenv serverip 192.168.1.100
    saveenv
  • OpenArbor stores information about the platform’s IP address in the lwip.config file.

  • Navigate to the platform project nai-ultrascale -> config -> lwip.config

  • Change the IP address on the following line:

    interface=xilinx-gem:0 192.168.1.16 255.255.255.0
  • More information can be found in the Deos NAI-Ultrascale BSP User Guide.

Speeding Up the Platform Build

To speed up builds and avoid building libraries that should not need to be modified during application development, we can follow a couple steps to point Open Arbor to the location of our built binaries.

  • Open OpenArbor and build all NAI libraries

  • Open a Windows PowerShell instance and run the script named release-me.ps1 with the following arguments

    ./release-me.ps1 -copyBinaries:$true
  • This will copy the parts of the "desk tree" in the output directory to a common location that OpenArbor can be pointed to look at

  • In OpenArbor navigate to Window -> Preferences -> DDC-I -> Deos Search Path

  • Click 'Add'. Change Preference Scope to This Workspace Only and browse to the path that the Power Shell script created: /SSK/deos/deos_kismet/$NAI_Board_Name/built-binaries/desk

    edit-text
  • Hit OK

  • Now, if you would like to skip building the NAI libraries you can "Close Project" on any applicable libraries that have been copied. OpenArbor will check the search path to see if it has binaries for those libraries and use them instead

  • If you need to debug any NAI libraries or want to navigate source, open up the projects

Running from the System

If you do not want to use your host pc terminal and would like to run an application you have loaded onto your single board computer, NAI SIU, or NAI NIU follow this guide.

Help Bot

X