AnsweredAssumed Answered

CMSIS DSP library and FPU configuration

Question asked by MangoniDario on Jun 6, 2013
Latest reply on Jun 10, 2013 by John F.
I tried for an entire afternoon to configure my IDE for compile CMSIS DSP library.
I don't know if there's somebody that is even duller than me but i want to give help to those people...

Here there's what i did:

1) Add the right folder to include path for the compiler:
- /cmsis-sp-00300-r3p1-00rel0/cmsis/include
- /cmsis-sp-00300-r3p1-00rel0/device/arm/armcm4/include

for CooCox CoIDE: Configuration>Compile>Includepaths

2) Add Defined Symbols (in compiler options not in main code!)
enable FPU Hardware (maybe also software if you don't have FPU)

for CooCox CoIDE: Configuration>Compile>Defined Symbols and "FPU hard"

3) Add libraries for the linker
- C:\Program Files (x86)\GNU Tools ARM Embedded\4.7 2013q1\arm-none-eabi\lib\armv7e-m\fpu\libm.a
(i think you could use: C:\Program Files (x86)\GNU Tools ARM Embedded\4.7 2013q1\arm-none-eabi\lib\armv7e-m\softfp\libm.a if you use software FPU)

- \CMSIS-SP-00300-r3p1-00rel0\CMSIS\Lib\GCC\libarm_cortexM4lf_math.a

The first file i think it's required for basic operations included in arm_math.h (like sqrtf); the second for more advanced DSP operations (not needed for sqrtf)

for CooCox CoIDE: Configuration>Link>Linked Libraries

4) Add code lines (in main.c) for defining core type and for including libraries
#define ARM_MATH_CM4
#include <arm_math.h>

I'm using STM32F4Discovery board (that use STM32F407VG) but i think that it could work with some change for other ARMs.

\CMSIS-SP-00300-r3p1-00rel0\ it's the folder of CMSIS library downloaded from ARM site

C:\Program Files (x86)\GNU Tools ARM Embedded\... it's my folder for GCC compiler

It's useful to know that:
- CoIDE libraries are GCC type libraries.
- i preferred to include path of CMSIS folder (that's the one which i've downloaded from ARM) but if you've downloaded STM32F4xx_DSP_StdPeriph_Lib from ST you'll notice that contains CMSIS folder that's the same! (to be thorough '\Device' folder it's inside \CMSIS); but remember: STM32F4xx_DSP_StdPeriph_Lib contains only files for STM32F4xx, CMSIS it's more general.
- libarm_cortexM4lf_math.a could be libarm_cortexM4l_math.a if you don't have hardware FPU, libarm_cortexM3l_math.a for Cortex-M3 and so on...
- you could change ARM_MATH_CM4 to ARM_MATH_CMx following suggestion from CMSIS manual included in the directory

If someone has more information or want to  suggest me to don't be silly the post it's open!
But especially SUGGEST US BETTER SOLUTIONS and tell me if there're are faster and more effective ways to do the same!!!