ARM Microcontroller Development with LabVIEW
Overview
The 32-bit RISC ARM processor architecture developed by ARM Limited is widely used across many embedded designs due to its low price, low power consumption, and wide variety of peripherals for many of the major silicon vendors. Today, the ARM family accounts for more than 75 percent of all 32-bit RISC CPUs. National Instruments offers two solutions for ARM Microcontroller development. The first is the LabVIEW Embedded Module for ARM Microcontrollers. This module was co-developed by National Instruments and ARM to deliver an out-of-the-box experience for programming ARM7, ARM9, and Cortex family microcontrollers. This solution is built on the Keil uVision IDE and the RTX real-time operating system from ARM. If you would like to use another toolchain or operating system, you can use the National Instruments LabVIEW Microprocessor SDK (Software Development Kit) for programming ARM microcontrollers with the eCos or Linux embedded operating systems. .
Table of Contents
Using the LabVIEW Embedded Module for ARM Microcontrollers
The NI LabVIEW Embedded Module for ARM Microcontrollers delivers a comprehensive development environment for ARM7, ARM9, and Cortex family microcontrollers. The development kit includes everything you need to get started including evaluation hardware, the ARM Microcontroller Development Kit C toolchain, and the LabVIEW Embedded Module for ARM Microcontrollers.
If you do not want to worry about the details of the operating system and C development process, this module is right for you. For more information, visit ni.com/arm.
Using the LabVIEW Microprocessor SDK
The LabVIEW Microprocessor SDK provides more flexibility for a variety of operating systems and C toolchains, but integration work is necessary to allow for programming a new processor. To aid in this development, NI provides a set of example targets than can be copied and modified. This tutorial examines the ARM7 traget that uses the eCos embedded operating system.
The Example Platform
The phyCORE-ARM7/LPC229x, available from PHYTEC, supports high-performance, low-power LPC2292 and LPC2294 ARM7TDMI-S devices from NXP Semiconductors (founded by Philips). Features include:
- 256 KB Flash memory
- 8-channel, 10-bit ADC
- PWM channels and up to nine external interrupt pins
- 10/100 Mb Ethernet controller
- Serial communications interfaces
These features make the devices particularly suitable for industrial control applications as well as medical systems and fault-tolerant maintenance buses.
In addition, the phyCORE-ARM7/LPC229x uses a general-purpose I/O expansion board, also available from PHYTEC. This provides general connectivity to many of the on-chip peripherals.
eCos is an open-source, royalty-free, real-time operating system. Because of the highly configurable nature of eCos, you can customize the operating system to precise application requirements. Many board support packages (BSPs) for various architectures and embedded development platforms are available from http://ecos.sourceware.org/.
Setting Up the System
RedBoot is a simple bootstrap program typically used with eCos devices as a means of downloading and maintaining applications as they run on a processor. The LabVIEW Microprocessor SDK provides a working RedBoot implementation, but you must install RedBoot on the processor before you can download, run, and debug LabVIEW microprocessor applications. You can find detailed steps for writing the RedBoot bootloader to ROM in the following directory of the Porting Guide:
…\LabVIEW X.X\manuals
The PHYTEC example target uses the GNU arm-elf toolchain that was built using the cygwin UNIX emulation environment. To cross compile the code generated by the LabVIEW Microprocessor SDK, you need cygwin and the GNU toolchain installed on your development PC. These tools are available for free from www.cygwin.com. You can find specific installation instructions in the Porting Guide.
Finally, the LabVIEW Microprocessor SDK provides a simple elemental I/O software programming interface to the peripherals of the device.
Writing Your First Program
- Launch LabVIEW.
- Create a new project by clicking “Empty Project.”

- Right-click on the project and choose New >> Targets and Devices … At this point, you see a list of all the example targets that are shipped with the LabVIEW Microprocessor SDK. Select the Phytec LPC229x, eCos target and click OK.

- Right-click on the newly created target in the project tree and select New » Elemental I/O.

- Add an analog input (AIN0) and a digital input/output (Line_GPIO_0_0) to the New Elemental I/O resources tree. Click OK.
- Return to the LabVIEW Project Explorer and add a new VI to the target by right-clicking the device and choosing New >> VI.
- This adds a new VI to your project and opens it so it is ready for editing. Save your project by selecting File >> Save As.
- Now you are ready to write your application. At this point, blink an LED and connect the analog input to a waveform chart. You can use the I/O nodes in your VI by simply dragging and dropping from the LabVIEW Project Explorer.

- Before you can build you application, you must first configure the Build Specifications. In the LabVIEW Project Explorer, right-click on Build Specifications under the ARM target and select New >> RAM Application.
- This brings up the Build Specification Properties dialog. For now, leave the default settings as is on the Application Information page. Click on Source Files and add your example as the Top-level VI.
- To run the project without debugging, click the Run arrow on the VI. This starts the application, but the LabVIEW front panel does not update. This is because “Run” for an embedded application only starts the embedded application, but it does not connect back to LabVIEW for embedded debugging.
- To connect your embedded application back to LabVIEW for debugging, you must enable debugging in the build specifications. Right-click on Build Specifications and select Properties to return to the Build Specification Properties dialog. This time, change the Debug mode to Instrumented Debugging. Click OK.
- Right-click on Build Specifications and choose Debug. This updates the front panel with live data from the running application.
Porting to Another ARM Microprocessor
If you are using the LabVIEW Embedded Module for ARM Microcontrollers, you should follow this tutorial.
If you choose an ARM platform with an already developed eCos BSP, the move is relatively straightforward. First, make a copy of the existing LabVIEW LPC229x target using the LabVIEW Target Editor. Then create elemental I/O nodes that access the correct memory-mapped registers on the new device using the Elemental I/O Wizard. Finally, validate the new target using the LabVIEW Microprocessor autotest suite. This exercises the vast majority of LabVIEW functionality and verifies that your target’s results match the expected results for each computation.
If you decide to move to a new architecture or operating system, the job becomes more involved. The code that the LabVIEW C Code Generator generates passes through a cross-compiler. If you add preexisting C code, the extra C files you provide also pass through the cross-compiler and are linked into an executable you can run on the embedded device, which is called a target in LabVIEW. You implement how this executable downloads, or deploys, to the correct memory location, and the executable begins running on the embedded target through standard communication protocols. JTAG emulators, RS232, and Ethernet are common ways to handle the communication between LabVIEW and an embedded target, but you can use other communication protocols. You also can implement instrumented or on-chip debugging so you can use LabVIEW to debug an embedded application you build with LabVIEW. Refer to the Porting Guide for information about target recommendations and required prerequisite knowledge to port LabVIEW to a new target. Porting includes the following main steps:
• Porting the LabVIEW Run-Time Library
• Incorporating I/O
• Creating the target in LabVIEW and incorporating your toolchain
• Customizing the LabVIEW environment
View an overview of this process in the short demonstration called Porting LabVIEW to Any 32-Bit Microprocessor.
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/).

