Skip to main content
November 25, 2022
Question

Eigen library and stm32cubeide

  • November 25, 2022
  • 6 replies
  • 3936 views

I was looking for using the Eigen library with stm32cubeide, but after adding the library, the compiler says it can not find cmath library. I tried to change the project to c++, but the error was persistent. Anyone has any sort of experience?

This topic has been closed for replies.

6 replies

KnarfB
Super User
November 26, 2022

A detailed description of the original compiler/linker commands and errors could help to nail your issue down.

hth

KnarfB

November 28, 2022

@KnarfB​ The problem of adding the library is now solved by changing the main file .c to .cpp, since cmath is a cpp library, but it seems this library is not thread-safe. After doing the first time multiplication or other linear algebra algorithms, the specified task doesn't run for the second time.

Semer CHERNI
ST Employee
November 28, 2022

Hello @Vahid Ajallooeian​ 

Is your application single threaded or do you call the Eigen API from multiple RTOS tasks or both main application and interrupt context?

Trying to understand what you mean with thread safe issue.

Check this link describing the thread safety solution with STM32Cube tool.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
December 23, 2022

@Semer CHERNI​  Sorry for late reply. Iran internet is locked by mullas.

My program is multithreaded by using freeRTOS. Formerly I was able to do matrix multiplication in pure handy method, so I know that it is possible. Now when I want to use the Eigen library in the thread while other tasks are running, the task which should do the linear algebra algorithms run only once. It seems to me that the Eigen is not thread safe as if in the documentation three is "no" sort of declaring that "it is thread safe". so I rolled back into the hand made multiplication. Did I miss something to achieve running Eigen if it is threadsafe?

Visitor II
February 16, 2024

I encountered the same problem in freertos as well, is there any solution for using eigen in multithreading? or any suggestion to use eigen in freertos? 

Visitor II
March 21, 2024

 

Hi, I'm writing to you because you wrote recently.
I have exactly this problem, did you manage to solve it by chance?