Compiling error when using CMSIS-DSP: conflicting types for 'clip_q63_to_q31'; have 'q31_t(q63_t)' {
I am trying to calculate the FFT using CMSIS-DSP.
I downloaded the latest CMSIS-DSP from github, copied folders CMSIS\DSP\Include, CMSIS\DSP\PrivateInclude and CMSIS\DSP\Source in my Drivers folder, added CMSIS\DSP\Include and CMSIS\DSP\PrivateInclude to my include path and removed all .c files in CMSIS\DSP\Source that does not have _f32 in the filename, since I am planning to use only float32 data.
My project is build with STM32CubeIDE and the microcontroller is a STM32L476RG.
The symbol ARM_MATH_CM4 is defined.
This is the code I'm trying to use:
#include "arm_math.h"
#include "arm_const_structs.h"
#define SAMPLES_NUMBER 1024
/* ----------------------------------------------------------------------
* Max magnitude FFT Bin calculation
*
* the input vector must be 1024 elements
* ------------------------------------------------------------------- */
float32_t fft(float32_t *input_vector, uint32_t sampling_rate)
{
float32_t maxValue;
uint32_t maxIndex;
float32_t frequency;
float32_t output_vector[SAMPLES_NUMBER / 2];
arm_cfft_instance_f32 fft_handler;
arm_status status;
status = ARM_MATH_SUCCESS;
// Init FFT module
status = arm_cfft_init_1024_f32(&fft_handler);
if (status != ARM_MATH_SUCCESS)
{
Error_Handler();
}
// Process the data through the CFFT/CIFFT module
arm_cfft_f32(&fft_handler, input_vector, 0, 1);
// Process the data through the Complex Magnitude Module to calculate the magnitude at each bin
arm_cmplx_mag_f32(input_vector, output_vector, SAMPLES_NUMBER / 2);
// Calculates maxValue and returns corresponding BIN value
arm_max_f32(output_vector, SAMPLES_NUMBER / 2, &maxValue, &maxIndex);
// Calculates the frequency corresponding to the max BIN value
frequency = (float32_t)maxIndex * (float32_t)sampling_rate / (float32_t)SAMPLES_NUMBER;
return frequency;
}
When I compile I get the following error:
conflicting types for 'clip_q63_to_q31'; have 'q31_t(q63_t)' {aka 'long int(long long int)'}
in file none.h
I noticed that none.h is included in arm_math.h, besides a lot of other include files.
What am I doing wrong?
