C/C++ Embedded System Design Tools


Embedded designers often choose devices with a heterogeneous architecture for advanced and critical applications because they combine two highly reliable processing targets: a processor running a real-time OS (RTOS) and programmable hardware. Efficient software tools are required to make this architecture a productive choice for embedded system design.

The NI platform is open and flexible so that you can choose from a variety of programming languages, tools, and design patterns to implement your system and make the best use of your IP and expertise. The pre-validated embedded OS is based on Linux and built with standard OpenEmbedded technologies so that you can write programs using LabVIEW software, C/C++, textual math, or a combination of these. You can easily recompile code from past projects to reduce new development efforts and even integrate LabVIEW with libraries and applications written in any language. The LabVIEW FPGA Module delivers a high-level programming environment that uses the Xilinx compiler to build optimized FPGA programs. Application-level developers can then connect to I/O immediately and write very powerful algorithms in a graphical language without any VHDL programming experience. The built-in RIO driver handles communication between the processor and FPGA, which frees up your time to focus on application logic rather than low-level driver software.

Use this document to learn about programming NI embedded systems and download the software tools you need.


Introduction to a Heterogeneous Architecture

Heterogeneous architecture

Figure 1. A heterogeneous architecture combines a processor, FPGA, and I/O with high-level programming tools.

The Intel processor runs NI Linux Real-Time, a real-time OS based on a standard kernel and designed specifically for reliable and deterministic operation in long-term deployments. It includes standard Linux features such as native support for Security-Enhanced Linux. The NI-DAQmx driver provides a single programming interface for acquiring waveforms and programming analog input, analog output, digital I/O, counters, and control.

The user programmable FPGA allows you to offload time-critical processes for advanced control, signal-processing, filtering, advanced timing, and other logic. NI uses the latest FPGA technology from Xilinx, with chips that contain up to 326, 060 logic cells, and 840 DSP slices.


NI’s Approach to Programming Heterogeneous Systems

While heterogeneous architectures that combine a processor and FPGA are extremely valuable for advanced and critical applications, programming such systems is a challenge. Challenges exist at every stage and include choosing or building the operating system, developing drivers to talk with I/O, and communicating between processor and FPGA, as well as finding the expertise needed to write FPGA programs and keep the development cycles of both targets in sync throughout the project.

NI addresses the challenges of heterogeneous software design by delivering a pre-validated software stack and high-level programming tools that you can build on, while maintaining openness and portability to future platforms. The architecture provides fully tested middleware, drivers, and a Linux OS out of the box so you can quickly port your application code to the NI platform. Continue to use your preferred application development tools and leverage the strengths of LabVIEW for real-time and FPGA programming. The true value of LabVIEW FPGA programming is that this abstracted approach to digital design empowers application-level C/C++ developers to implement the most critical portions of their applications in hardware, which they may never have done otherwise without having VHDL experts on staff.

Program the embedded processor with LabVIEW or any Linux compatible tools and use the NI RIO driver to communicate with LabVIEW FPGA

Figure 2. Program the embedded processor with LabVIEW or any Linux compatible tools and use the NI RIO driver to communicate with LabVIEW FPGA.


Real-Time Programming

Embedded system designers working with NI hardware can choose from a variety of programming languages and tools when architecting their systems. Developers can program the open embedded processor with LabVIEW, C/C++, or textual math; and they can reuse source code from past projects to save development time. Programmers can reuse C/C++ libraries from past projects by calling them from within a LabVIEW Real-Time application, which simplifies tasks like real-time thread scheduling. Alternatively, developers can develop, debug, and deploy applications to the embedded processor written entirely in C or C++ using their preferred integrated development environment (IDE).


FPGA Programming

Introducing FPGAs into embedded system design makes it possible to create high-performance digital logic without the need for custom ASIC design. Traditionally, text-based hardware description languages such as VHDL or Verilog written by digital design engineers, have been used for FPGA development. 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 industry’s quest to find higher level abstractions for FPGA design, such as C-to-gates tools, or graphical programming languages such as G in LabVIEW FPGA.


The LabVIEW graphical programming environment abstracts the complexity of FPGA hardware and delivers programming constructs familiar to software engineers so users can design high-performance embedded systems faster.


Developer Resources: C/C++ Development Tools for Linux Real-Time

Since NI hardware runs a standard Linux OS, you can build your embedded application using any Linux-compatible tools. This gives you the flexibility to reuse your IP, expertise, and development tools, but you need to understand where and how these can integrate with LabVIEW Real-Time and LabVIEW FPGA.


 Choose a software design pattern based on IP reuse and real-time programming expertise

Figure 3. Choose a software design pattern based on IP reuse and real-time programming expertise.


You must use LabVIEW FPGA to program the Xilinx FPGA, but you can use either C/C++ or LabVIEW Real-Time to communicate with the LabVIEW FPGA program. There is both a C API and a LabVIEW API for the communication layer between the processor application and the LabVIEW FPGA program. Thus, the first step in designing your NI Linux Real-Time system is to choose a top-level software design pattern.

Choosing LabVIEW to program the real-time application has many advantages in that LabVIEW Real-Time includes built-in constructs for multithreading, real-time thread scheduling, and many other features specific to building robust, deterministic code. In addition, LabVIEW can interface with shared libraries and applications written in other languages so that this valuable IP can be reused in the LabVIEW Real-Time design pattern.

However, in cases when the top-level application must be written solely in C/C++, you can use LabVIEW only for programming the I/O in the FPGA, and evaluate which critical tasks should be moved to execute in hardware instead of on the processor.

Resources to Get Started

  1. Start by learning about possible software design patterns for your NI embedded system: Choosing a Software Architecture for Programming NI Linux Real-Time Systems.
  2. Set up a preferred IDE for building, deploying, and debugging a C/C++ shared library or top-level application. You can find information about how to complete these tasks by visiting Getting Started with C/C++ Development for NI Linux Real-Time.
  3. Learn how to call C/C++ shared libraries from you LabVIEW Real-Time application by following the steps in this tutorial: Integrating C Code with LabVIEW on NI Linux Real-Time Targets
  4. Learn more about how to communicate with a LabVIEW FPGA program from a C/C++ real-time application using the FPGA Interface C API: Programming with the FPGA Interface C API Whitepaper and Exercise
  5. Visit our active developer forums for answers on advanced questions regarding C/C++ and Linux programming: NI Linux Real-Time Community


Software Toolchains Required

  1. For programming your NI Linux Real-Time application, you need at least one of the following tools:
    1. Download the LabVIEW Real-Time Module if you plan to build your top level real-time application using LabVIEW.

    2. Download just the GNU/Linux cross compiler if you plan to use your own C/C++ development tools to build a shared library or top-level application:
  2. Download the FPGA Interface C API (Version 13.0 or later) if you plan to build your top-level real-time application in C/C++. The FPGA Interface C API generates a C header file based on your LabVIEW FPGA bitfile that exposes the named reference variables of your FPGA registers, DMA FIFOs, and interrupts. It also includes an API of functions used to read and write to these variables and manipulate operation of your FPGA code.

  3. FPGA development requires all the following:
    1. LabVIEW (Full or above)
    2. LabVIEW FPGA Module
    3. NI-RIO Driver (Version 2013 or later)

Developer Resources: LabVIEW for FPGA Development

LabVIEW is distinctly suited for FPGA programming because it clearly represents parallelism and data flow. With LabVIEW FPGA, engineers and scientists with C expertise can take advantage of FPGAs within their designs without the burden of learning hardware design. In addition, the FPGA Interface C API delivers a communication layer between the FPGA and real-time application for I/O control and data streaming. With this API, you can use LabVIEW graphical tools to program the FPGA and choose either LabVIEW or C/C++ tools to program the processor within the system. 


LabVIEW FPGA helps you 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, ultra-high-speed control, interfacing to digital protocols, digital signal processing, and many other applications requiring high-speed hardware reliability and tight determinism.