C/C++ Embedded System Design Tools

Publish Date: Sep 25, 2017 | 5 Ratings | 4.00 out of 5 | Print

Overview

Embedded designers choose the NI reconfigurable I/O (RIO) architecture for advanced and critical applications because NI embedded devices combine two highly reliable processing targets: a real-time OS (RTOS) and programmable hardware, with the software tools needed 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.

Table of Contents

  1. Introduction to the NI Embedded Systems Architecture
  2. NI’s Approach to Programming Heterogeneous Systems
  3. Developer Resources: C/C++ Development Tools for Linux Real-Time
  4. Developer Resources: LabVIEW for FPGA Development

1. Introduction to the NI Embedded Systems Architecture

The NI RIO architecture combines a processor running an RTOS with a user-programmable FPGA in a variety of hardware for factors that include CompactRIO and Single-Board RIO System on Module (SOM). You can use his architecture to optimize your software design for performance and determinism because code can be partitioned across these heterogeneous processing targets based on the criticality of individual tasks. For example, the top-level state machine, network, and peripheral communication can run on the real-time side. The FPGA can handle I/O, high-speed control, safety logic, signal processing, and custom protocols. The high-speed DMA bus between the processor and FPGA handles the low-latency transfer of data streaming, interrupts, and commands.

 

Figure 1. The NI RIO architecture combines a processor, FPGA, and I/O with high-level programming tools.

 

Embedded Processor With RTOS: The NI RIO architecture is built on the highest quality, industry-standard ARM or Intel processors running NI Linux Real-Time. NI Linux Real-Time is a Linux distribution based on standard OpenEmbedded technologies with built-in, industrial-grade, real-time capabilities through the PREEMPT_RT patch set. Through years of R&D development, the work of the Linux open-source community, and partner contributions, NI Linux Real-Time was designed specifically for reliable and deterministic operation in long-term deployments while offering security improvements and increased resiliency to application crashes.

FPGA: The user-programmable Xilinx FPGA, a reprogrammable silicon chip, adds the performance and reliability needed for high-speed control, inline data processing, or complex timing and triggering. In contrast to processors that you find in your PC, programming an FPGA rewires the chip to implement your functionality rather than run a software application. Each independent processing task is assigned to a dedicated section of the chip and can function autonomously without any influence from other logic blocks. As a result, the performance of one part of the application is not affected when you add more processing.

 

Back to Top

2. 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 RIO architecture 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.

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 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 Eclipse or another 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.

 

Back to Top

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

Since the NI RIO architecture is based on 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.

 

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 Eclipse for building, deploying, and debugging a C/C++ shared library or top-level application by following the steps in this tutorial: Getting Started With C/C++ Development Tools for NI Linux Real-Time, Eclipse Edition
  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 a CompactRIO Running NI Linux Real-Time
  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 the C/C++ development Tools for NI Linux Real-Time, Eclipse Edition if you plan to build a shared library or top-level application using the Eclipse IDE. This download includes GNU/Linux cross compilers for both ARM and x64 Intel processor architectures.

    3. 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:
  1. 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.

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

 

Back to Top

4. 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.

Resources to Get Started

  1. Learn more about FPGA technology and its potential use in your application.
  2. Watch a few short videos that demonstrate Getting Started With LabVIEW FPGA.
  3. Download a 90-day evaluation of LabVIEW FPGA Module.

 

Figure 4. Autonomous timed loops in LabVIEW FPGA represent independent tasks running on dedicated sections of the FPGA chip.

 

 

The registered trademark Linux® is used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a worldwide basis.

 

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit