Skip to main content
Mnemocron
Associate III
Nov 27, 2019 3:56 PM UTC
Solved

How to I get Keil uVision 5 to compile CMSIS/DSP Library? (arm_math.h / int32_t is not a type name)

I am trying to include the CMSIS/DSP Library into a uVision 5 Project generated by STM32CubeMX.

I went to "Runtime Settings" and included checked the DSP checkbox.

http://stm32f4-discovery.net/2014/10/stm32f4-fft-example/fft-enable-dsp-library-keil/

In main.c I added the include line <arm_math.h>

In the preprocessor settings I added the Symbol "ARM_MATH_CM4".

STM32F412Re / Keil uVision 5

What am I missing?

The compiler throws 30 errors like:

compiling main.c...
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(645): warning: #47-D: incompatible redefinition of macro "__PKHBT" (declared at line 852 of "../Drivers/CMSIS/Include/cmsis_armcc.h")
 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(647): warning: #47-D: incompatible redefinition of macro "__PKHTB" (declared at line 855 of "../Drivers/CMSIS/Include/cmsis_armcc.h")
 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(1183): error: #79: expected a type specifier
 __STATIC_FORCEINLINE int32_t __SMMLA(
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(1183): error: #101: "int32_t" has already been declared in the current scope
 __STATIC_FORCEINLINE int32_t __SMMLA(
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(1183): error: #141-D: unnamed prototyped parameters not allowed when body is present
 __STATIC_FORCEINLINE int32_t __SMMLA(
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(1188): error: #20: identifier "sum" is undefined
 return (sum + (int32_t) (((int64_t) x * y) >> 32));
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(1188): error: #20: identifier "x" is undefined
 return (sum + (int32_t) (((int64_t) x * y) >> 32));
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(1188): error: #20: identifier "y" is undefined
 return (sum + (int32_t) (((int64_t) x * y) >> 32));
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(1801): error: #757: function "int32_t" is not a type name
 int32_t shift,
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(1816): error: #757: function "int32_t" is not a type name
 int32_t shift,
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(1914): error: #757: function "int32_t" is not a type name
 int32_t resetStateFlag);
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(1932): error: #757: function "int32_t" is not a type name

This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Nov 27, 2019 4:20 PM UTC

Pretty sure code from 2014 isn't CMSIS 5.6.x

Seem to be mixing things up, perhaps better to use contemporaneous sources.

Would those types be in stdint.h ?

I'd perhaps set up a coherent set of Include Paths so it doesn't pull from assorted locations the compiler pulls from a hat.

STM32Cube_FW_F4_V1.24.1\Drivers\CMSIS\DSP\Include

STM32Cube_FW_F4_V1.24.1\Drivers\CMSIS\Include

STM32Cube_FW_F4_V1.24.1\Drivers\CMSIS\Core\Include

STM32Cube_FW_F4_V1.24.1\Drivers\CMSIS\Device\ST\STM32F4xx\Include

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..

3 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Nov 27, 2019 4:20 PM UTC

Pretty sure code from 2014 isn't CMSIS 5.6.x

Seem to be mixing things up, perhaps better to use contemporaneous sources.

Would those types be in stdint.h ?

I'd perhaps set up a coherent set of Include Paths so it doesn't pull from assorted locations the compiler pulls from a hat.

STM32Cube_FW_F4_V1.24.1\Drivers\CMSIS\DSP\Include

STM32Cube_FW_F4_V1.24.1\Drivers\CMSIS\Include

STM32Cube_FW_F4_V1.24.1\Drivers\CMSIS\Core\Include

STM32Cube_FW_F4_V1.24.1\Drivers\CMSIS\Device\ST\STM32F4xx\Include

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Mnemocron
MnemocronAuthor
Associate III
Nov 27, 2019 7:42 PM UTC

Adding the ../Drivers/CMSIS/DSP/Include path did the job. It now compiles without errors. Thank you!

nmiah.1
Visitor II
Dec 17, 2019 7:35 AM UTC

Yeah...

Also worked for me just by adding separate Header file from STM firmware repository.

Was a great help.