Skip to main content
Graduate
November 8, 2024
Solved

ARM CMSIS DSP undefined reference error

  • November 8, 2024
  • 3 replies
  • 2083 views

Hey I am trying to use CMSIS DSP library to perform FFT of i2s data from a mic but it is showing error after using the FFT functions but is compling if only library is added is there any thing I have missed

this is the code:

/* USER CODE END Header */

/* Includes ------------------------------------------------------------------*/

#include "main.h"



/* Private includes ----------------------------------------------------------*/

/* USER CODE BEGIN Includes */

#include "arm_math.h"

#include "arm_const_structs.h"

/* USER CODE END Includes */



/* Private typedef -----------------------------------------------------------*/

/* USER CODE BEGIN PTD */



/* USER CODE END PTD */



/* Private define ------------------------------------------------------------*/

/* USER CODE BEGIN PD */



/* USER CODE END PD */



/* Private macro -------------------------------------------------------------*/

/* USER CODE BEGIN PM */



/* USER CODE END PM */



/* Private variables ---------------------------------------------------------*/

I2S_HandleTypeDef hi2s1;



/* USER CODE BEGIN PV */

#define FFT_size 256

q15_t buf[FFT_size];

q15_t input_signal[FFT_size];

q15_t Complex[2*FFT_size];

q15_t Real[FFT_size];



/* USER CODE END PV */



/* Private function prototypes -----------------------------------------------*/

void SystemClock_Config(void);

static void MX_GPIO_Init(void);

static void MX_I2S1_Init(void);

/* USER CODE BEGIN PFP */



/* USER CODE END PFP */



/* Private user code ---------------------------------------------------------*/

/* USER CODE BEGIN 0 */

void FFT_compute(){

arm_cfft_q15(&arm_cfft_sR_q15_len256, buf, 0, 1);

arm_cmplx_mag_q15(buf,Real,FFT_size);

}



/* USER CODE END 0 */



/**

* @brief The application entry point.

* @retval int

*

*/

int main(void)

{



/* USER CODE BEGIN 1 */



/* USER CODE END 1 */



/* MCU Configuration--------------------------------------------------------*/



/* Reset of all peripherals, Initializes the Flash interface and the Systick. */

HAL_Init();



/* USER CODE BEGIN Init */



/* USER CODE END Init */



/* Configure the system clock */

SystemClock_Config();



/* USER CODE BEGIN SysInit */



/* USER CODE END SysInit */



/* Initialize all configured peripherals */

MX_GPIO_Init();

MX_I2S1_Init();

/* USER CODE BEGIN 2 */

/* USER CODE END 2 */



/* Infinite loop */

/* USER CODE BEGIN WHILE */

while (1)

{

/* USER CODE END WHILE */



/* USER CODE BEGIN 3 */

HAL_I2S_Receive(&hi2s1, buf, FFT_size, 1);

FFT_compute();

}

/* USER CODE END 3 */

}

 

 

    This topic has been closed for replies.
    Best answer by KDJEM.1

    Hello @DivergentV ,

     

    Which CMSISI version are you using?

    Make sure that you are using the “/” and not the “\” in the paths

    I hope this help you.

    Thank you.

    Kaouthar

    3 replies

    Graduate II
    November 8, 2024

    Linker errors occur because you don't add the library or it's source to the project.

    An INCLUDE file typically doesn't add code, it provides the inferface details, the code behind the library still needs to be accessible to the LINKER

    Graduate
    November 8, 2024

    Can you please share a method to correctly include as I have tried many different ways but I get the same error

    Graduate II
    November 8, 2024

    I'm not using your tools. But standard compiler/linker methods dictate

    Step#1 include paths for tools, and add #include in your source

    Step#2 Add the library .a file if prebuilt so the linker knows where the function bodies live, or add library source files to your project directly so the compiler compiles them.

    KDJEM.1Answer
    Technical Moderator
    November 11, 2024

    Hello @DivergentV ,

     

    Which CMSISI version are you using?

    Make sure that you are using the “/” and not the “\” in the paths

    I hope this help you.

    Thank you.

    Kaouthar

    Technical Moderator
    November 11, 2024

    Hello @DivergentV ,

    In next time please use </> button to paste your code. I've edited your post then ..

    See tips on posting.