Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
What is Developer Zone?
United States

Document TypeTutorial
NI Supported: Yes
Publish Date: Mar 03, 2012


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links -Products and Services

Developing with the C Interface to LabVIEW FPGA for VxWorks Targets

1 Ratings | 5.00 out of 5
Read in  |  Print |  PDF

Overview

Designers have traditionally used programming languages such as C to develop embedded systems based around microprocessor or microcontroller architecture. The popularity of C has led to a large ecosystem of technology choices for tools such as libraries, compilers, and operating systems. Field-programmable gate arrays (FPGAs) are a newer technology in the embedded space that provides the ability to create reconfigurable digital logic using hardware description languages. To represent the hardware and take advantage of the high-performance parallel nature of digital circuitry, hardware description languages offer very different semantics than software engineers are accustomed to using. By providing development environments for FPGAs that provide programming constructs familiar to software engineers, embedded software engineers can reap the benefits of using FPGAs in their designs.

Table of Contents

  1. FPGA Development
  2. CompactRIO Platform
  3. Using the C Interface to LabVIEW FPGA
  4. Additional Resources

FPGA Development

The introduction of FPGAs into embedded system design has made it possible to create high-performance digital logic without the need for custom ASIC design. Traditionally, FPGA development is performed with text-based hardware description languages such as VHDL or Verilog, which is written by digital design engineers. Unfortunately, due to challenging language semantics, these hardware description languages make it difficult to take advantage of the full capabilities of FPGA design. This is evidenced by the embedded industries quest to find higher-level abstractions for FPGA design, such as C to gates tools, or graphical programming languages such as LabVIEW FPGA.

Because LabVIEW is a full-featured programming language, developers familiar with traditional text-based programming languages such as C will feel comfortable while using the environment, while at the same time be able to take advantage of a new hardware platform – FPGA.

Figure 1. Develop FPGA code using LabVIEW FPGA

CompactRIO Platform

The NI CompactRIO platform offers a low-cost reconfigurable embedded system designed for applications that require high performance and reliability. The system combines an open embedded architecture with small size, extreme ruggedness, and hot-swappable industrial I/O modules. The platform is a packaged embedded system that has been ruggedized for industrial environments. In addition to the CompactRIO platform, NI Single-Board RIO offers the same architecture without the packaging.

Figure 2. CompactRIO and NI Single-Board RIO Embedded Hardware Platforms

The RIO platform comprises two programmable targets: PowerPC-based processor and an FPGA. LabVIEW is distinctly suited for FPGA programming because it clearly represents parallelism and data flow. With the LabVIEW FPGA Module, you can create custom measurement and control hardware without low-level hardware description languages or board-level design. You can use this custom hardware for unique timing and triggering routines, ultrahigh-speed control, interfacing to digital protocols, digital signal processing (DSP), and many other applications requiring high-speed hardware reliability and tight determinism.

Figure 3. RIO Embedded Hardware Architecture

The PowerPC processor in the CompactRIO architecture runs the VxWorks operating system from Wind River. There are two methods to develop software for the VxWorks target: LabVIEW Real-Time and C. With LabVIEW Real-Time, you can develop LabVIEW applications to run on the embedded system and communicate easily with the FPGA target through high-level abstraction. With the latest version of the NI-RIO drivers, C programmers can directly program the PowerPC processor and interface with the FPGA.

Figure 4. Develop C or LabVIEW Code to the Target Real-Time Processor of RIO Architecture

Using the C Interface to LabVIEW FPGA

With the C Interface to LabVIEW FPGA, you can program the real-time VxWorks operating system C tools such as Wind River Workbench or the GNU GCC tool chain for VxWorks.

You can obtain the GNU tool chain for VxWorks either by purchasing a VxWorks development license from Wind River or by downloading the redistributable GNU tool chain attached to this document. By purchasing VxWorks, you can use the Wind River Workbench IDE, featuring source code-level debugging and build management. The redistributable GNU tool chain offers debugging only at the assembly code level, and you must use the included GNU Make to build binaries.

Figure 5. Software Tools Stack for C Code Development

Once the LabVIEW FPGA code is developed, a header file is generated. This provides an interface for accessing controls, indicators, DMA FIFOs, interrupts, and arrays. The header file must be included in the C-based application.


Figure 6. Wind River Workbench IDE Option for Developing Embedded Applications

Including the provided header file into the VxWorks project helps the programmatic interface to communicate with LabVIEW FPGA.

To learn more about configuring your VxWorks development environment and deploying compiled C code, visit Deploying Applications to VxWorks Targets.

Additional Resources

Purchase the NI Embedded Software Evaluation Kit for your prototyping needs

 

1 Ratings | 5.00 out of 5
Read in  |  Print |  PDF

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).