Skip to main content
M623
Associate II
January 7, 2021
Solved

Hello, I use X-CUBE-MEMS1 in CubeIDE. I added MOTION_FX in my project (like my images) but when i call a function in MotionFx, i have error "undefined reference". Could you tell me how to fix it ? Thank you.

  • January 7, 2021
  • 7 replies
  • 3036 views

..

This topic has been closed for replies.
Best answer by KnarfB

0693W000006HrQUQA0.png

7 replies

KnarfB
Super User
January 7, 2021

If you're using a Cortex-Mo M0+ MCU, use the functions from  motion_fx_cm0p.h, e.g. MotionFX_CM0P_initialize();

see "Getting started with MotionFX sensor fusion library in X-CUBE-MEMS1 expansion for STM32Cube" usr manual.

M623
M623Author
Associate II
January 7, 2021

I use STM32WB - CortexM4.

But i have the same problem with all the functions in motion_fx.h and motion_fx_cm0p.h.

My IDE can't find the reference to these functions

Cartu38 OpenDev
Graduate II
January 7, 2021

Works for me if STM32CubeIDE 1.5.1 & MEMS pack 8.2.0.

Please note .a file is used (archive file <=> precompiled code) ... I guess function implementation is part of.

0693W000006Hp2aQAC.jpg 

KnarfB
Super User
January 7, 2021

Exactly. The last (linker) step in the build console should link that library (-l). Exact name depends on MPU core.

arm-none-eabi-gcc -o "MotionFX.elf" @"objects.list" -l:MotionFX_CM0P_wc32_ot.a ...

If not, check that the library is in project properties:

0693W000006HpNiQAK.png

M623
M623Author
Associate II
January 7, 2021

Thank you,

I added Library Paths like you but it cannot find the MotionFX_CM4F_wc32_ot.a

I don't know how to link to .a file

KnarfB
KnarfBBest answer
Super User
January 7, 2021

0693W000006HrQUQA0.png

M623
M623Author
Associate II
January 8, 2021

Thank you for all support,

Finally it works for me :beaming_face_with_smiling_eyes:

For information, with Cortex M4 we need to config the Floating point to work with MotionFx. More information here :

https://community.st.com/s/question/0D50X0000AkPUqYSQW/motionfx-library-arm-cortexm4f-hardware-floating-point