2

I'm working on a bare-metal project on the STM32F4Discovery Board and I'm trying to integrate the CMSIS DSP library.
I've downloaded the pre-compiled library and include files for the Cortex M4 processor from this Github Repository. I also downloaded the include files of CMSIS/Core/Include since I read that the CMSIS library is required for the DSP library.

DSP
├── Include
|   ├── core //Here I added the CMSIS/Core includes.
|   └── dsp
└── libarm_cortexM4lf_math.a

In order to use it I added to my main.cpp file the following line:

#define ARM_MATH_CM4

#include "arm_math.h"

but when I compile the whole project I get the following error

DSP/Include/arm_math_memory.h:76:1: error: '__STATIC_FORCEINLINE' does not name a type

Why do I get this error? How can I fix it?

Gio
  • 61
  • 1
  • 6

1 Answers1

2

That is... weird. Have you tinkered with the CMSIS (DSP) header files in any way?

As you have correctly realized CMSIS DSP depends on CMSIS. If you take a look at the arm_math_types.h header from the DSP library you can see that it includes a header called cmsis_compiler.h from CMSIS. As the name suggests this header is supposed to take care of various ARM compiler differences like for example how static inline functions can be declared. The macro __STATIC_FORCEINLINE is supposed to abstract that part for the rest of the CMSIS library so that it's independent from the actually used compiler.

Since you're not getting any missing header errors I assume you have set up your project correctly and those headers are found. So the question is, what compiler are you using? Is it supported? And if yes, how comes it falls through the __STATIC_INLINE definition?

Vinci
  • 1,382
  • 10
  • 12
  • I'm using a [patched version of GCC](https://miosix.org/wiki/index.php?title=Miosix_Toolchain). The motivation is that in my project I'm using the RTOS [miosix](https://miosix.org), because my work is based on it. Since it should work as GCC I didn't think that it could be a problem. – Gio Nov 04 '22 at 13:33
  • 2
    I guess this version does define `__GNUC__`. Have you checked if *cmsis_gcc.h* does get included correctly? (e.g. delete it, see if it's recognized at all or place some #error statements) – Vinci Nov 04 '22 at 14:49
  • 2
    Thanks to your questions and suggestions I found what was the problem The RTOS that I'm working with already has some of the header file from CMSIS/Core and among them there is also the cmsis_gcc.h file, and older version though where the _STATIC_FORCEINLINE is not defined. Copying the definition of that macro in the newest version solved my problem, and I tried the matrix multiplication and everything works smooth, so up to now there are no conflict. Thanks again! – Gio Nov 05 '22 at 09:09