Helium-enhanced libraries

Libraries provide a suite of functions you can use in your own code.  Helium-enahanced libraries provide implementations of those functions that use Helium instructions.

When you compile for a Helium-enabled target, a library variant using Helium instructions is selected. When you compile for a target that does not support Helium, a library variant using standard Arm instructions is selected. This means that you can easily compile the same source code for both Helium and non-Helium enabled targets.

Examples of Helium-enabled libraries include:

  • CMSIS-DSP –   A suite of common signal processing functions for use on Cortex-M processor-based devices
  • CMSIS-NN –   A collection of efficient neural network kernels that are developed to maximize the performance, and minimize the memory footprint, of neural networks on Cortex-M processor cores

In this section of the guide, we examine the CMSIS-DSP library to see how to use libraries to write Helium-enabled code.

Getting the CMSIS-DSP library

The CMSIS-DSP library provides functions that are specifically designed for signal processing. The library provides over sixty common signal processing and mathematical functions for various data types.

CMSIS is the Arm Cortex Microcontroller Software Interface Standard. CMSIS provides a vendor-independent hardware abstraction layer for microcontrollers that are based on Arm Cortex processors. CMSIS defines generic tool interfaces and enables consistent device support. Its software interfaces simplify software reuse, reduce the learning curve for microcontroller developers, and improve time to market for new devices.

CMSIS is integrated into IDEs like Keil MDK and Arm Development Studio, but can also be used with a standalone compiler.

To use CMSIS:

Writing code using the CMSIS-DSP library

The CMSIS-DSP pack includes various examples. For example, the variance example demonstrates the use of basic math functions to calculate the variance of an input sequence.

Let's examine the source code of this example to look at some key features:

#include "arm_math.h"

The preceding code shows the CMSIS-DSP header file that declares the basic math functions used by the example. This code must be included to use the CMSIS-DSP functions.

The following code shows how the variance example uses CMSIS-DSP library functions to implement an algorithm that calculates the statistical variance of an input stream. The CMSIS-DSP functions are arm_fill_f32(), arm_dot_prod_f32(), and arm_mult_f32()

/* Calculation of mean value of input */
/* x' = 1/blockSize * (x(0)* 1 + x(1) * 1 + ... + x(n-1) * 1) */
/* Fill wire1 buffer with 1.0 value */
arm_fill_f32(1.0,  wire1, blockSize);

/* Calculate the dot product of wire1 and wire2 */
/* (x(0)* 1 + x(1) * 1 + ...+ x(n-1) * 1) */
arm_dot_prod_f32(testInput_f32, wire1, blockSize, &mean);

/* Calculation of 1/blockSize */
oneByBlockSize = 1.0 / (blockSize);

/* 1/blockSize * (x(0)* 1 + x(1) * 1 + ... + x(n-1) * 1)  */
arm_mult_f32(&mean, &oneByBlockSize, &mean, 1);


The CMSIS-DSP functions used in this example are:

All available CMSIS-DSP functions are described in the CMSIS DSP Software Library Reference.

Compiling CMSIS-DSP code for Helium

When compiling for a Helium-enabled target, the compiler will automatically select the CMSIS-DSP variant that uses Helium instructions.

For example, in Arm Development Studio select Generic Armv8.1-M Main (MVE Integer) to target any Helium-enabled Armv8-M platform, as shown in the following screenshot:

When compiling with a standalone compiler, you must ensure that the CMSIS header files are on the include path, and the CMSIS libraries are on the library path.

For example, to target the architecture, use this command:

armclang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp+fp.dp
            -I <cmsis_dir>/DSP/Include/ -L <cmsis_dir>/DSP/Lib/ ...

To target the Cortex-M55, use this command:

armclang -target arm-arm-none-eabi -mcpu=cortex-m55 -I <cmsis_dir>/DSP/Include/
            -L <cmsis_dir>/DSP/Lib/ ...
Previous Next