Using CMSIS-DSP with MCUXpresso SDK and IDE
Follow these steps to link the CMSIS-DSP library to a MCUXpresso SDK 2.x project using the MCUXpresso IDE. The steps described in the document were done using the MKL25Z MCU like the one in the FRDM-KL25Z board, but the same principles are applicable to any Kinetis MCU.
Please make sure you have already created and installed the corresponding MCUXpresso SDK package to the MCUXpresso IDE, you can use following links as reference:
Getting Started with MCUXpresso and FRDM-K64F
Generating a downloadable MCUXpresso SDK v.2 package
Creating a MCUXpresso SDK 2.x Project:
1) Click on the Import SDK example option from the Quickstart menu:
2) For this demonstration the Hello World example is used:
3) The new project should now appear on your workspace:
Linking CMSIS-DSP Library:
1) The first step is to create a build variable that will be used to specify the path of the DSP library. Go to Project > Properties and under C/C++ Build select Build Variables and click on Add:
2) A new window will open, specify the name of the build variable, its type and value, the Value is the location of your CMSIS folder:
Variable name: SDK_2.2_KL25Z_CMSIS_PATH
Value: C:\nxp\SDK_2.2_FRDM-KL25Z_MCUX\CMSIS
NOTE: The SDK_2.2_FRDM-KL25Z package was previously unzipped to the C:\nxp folder
3) The new variable should be listed as in the image below, click on Apply:
4) Go to C/C++ Build > Settings > MCU Linker > Libraries and specify the precompiled library to be used and its path:
Library name: arm_cortexM0l_math.The M denotes the ARM core, while the ‘l’ means ‘little endian’.
Path: ${SDK_2.2_KL25Z_CMSIS_PATH}\Lib\GCC
5) Now go to C/C++ Build > Settings > MCU C Compiler > Preprocessor and specify the following macro:
ARM_MATH_CM0PLUS: Tells the CMSIS library which ARM Cortex core I’m using.
Importing DSP example source files:
1) For this project the “FIR Lowpass Filter” example will be used, it can be found on the following path:
${SDK_2.2_KL25Z_CMSIS_PATH}\DSP_Lib\Examples\arm_fir_example\ARM
2) The first step is to copy the source files of the example to the project, the files that need to be copied are:
arm_fir_example_f32.c
arm_fir_data.c
math_helper.c
math_helper.h
3) The next step is to copy the SDK include files and initialization functions from the hello_world.c file to the FIR example file:
#include "fsl_device_registers.h"
#include "fsl_debug_console.h"
#include "board.h"
#include "pin_mux.h"
BOARD_InitPins();
BOARD_BootClockRUN();
BOARD_InitDebugConsole();
4) Finally the hello_world.c file can be deleted from the project:
5) Now you should be able to compile and debug the project.
Related links:
Generating a downloadable MCUXpresso SDK v.2 package
Getting Started with MCUXpresso and FRDM-K64F
Adding CMSIS-DSP Library to a KSDK 2.x project in Kinetis Design Studio
Hey! Thank you for the guide!
I have a question about using CMSIS-DSP,
I'm running Kinetis Design Studio 3.2, MQX 4.2 and SDK 1.x project. There is SDK2.x but it doesn't seem to support K70F120M board.
Are you instructions similar in that I can just link it like you did?
Sorry if this is the wrong place to ask.