Integrating CMSIS DSP library to Atollic TrueSTUDIO

In this post, we will show how to integrate CMSIS DSP library to the free licensed ARM development environment called TrueSTUDIO. Since free Keil uVision version supports limited code size, you may need another development platform which has no limits for code size. One option for this platform is Atollic TrueStudio.

First thing to do is downloading the latest version of CMSIS library from the Github link or you can install the DSP library from Keil pack installer.

A fresh STM32F4 project generated from CubeMX has the directories shown in below image.

Access the FIR bandpass tutorial

You can find the related FIR bandpass filtering post from this link or access the code from this Github page.

Adding built-in variables

You should add some symbols to the project. Open the symbols declarations from project properties “Project –> Properties –> C/C++ Generals –>Paths and Symbols –> Symbols”.

  • Define the ARM math library according to the related Cortex core. This is required since we use math library of ARM and use instance structues for DSP operations such as filtering (arm_fir_instance_f32). For the STM32F4 Cortex M4, we define ARM_MATH_CM4 in the symbols. By doing these, correct DSP libraries for our Cortex will be used.
  • Define __FPU_PRESENT in the symbols. This sometimes are not required.

Copying necessary source and header files

For the FIR filtering, we require some .c source files from DSP library such as initializing and filtering processes. Those source files should be copied to the project’s source directory.

To create an arm_fir_instance_f32, we need to copy and include arm_math.h file which is located at \CMSIS\DSP\Include folder into our Inc directory.

The below code require two .c source files named as arm_fir_init_f32.c and arm_fir_f32.c files. Those files can be copied from \CMSIS\DSP\Source\FilteringFunctions directory to the Src directory of the project.

  /* Call FIR init function to initialize the instance structure. */
  arm_fir_init_f32(&S, NUM_TAPS, (float32_t *)&firCoeffs32[0], &firStateF32[0], blockSize);
  /* ----------------------------------------------------------------------
  ** Call the FIR process function for every blockSize samples
  ** ------------------------------------------------------------------- */
  for(i=0; i < numBlocks; i++)
    arm_fir_f32(&S, inputF32 + (i * blockSize), outputF32 + (i * blockSize), blockSize);

The final version of the project directory is shown in below figure.

For another type of CMSIS DSP example, we should again copy the necessary functions from CMSIS source folder to our Src and Inc directory and that’s the only thing we need to do.

One Reply to “Integrating CMSIS DSP library to Atollic TrueSTUDIO”

Leave a Reply

Your email address will not be published. Required fields are marked *