FPU crash (probably) using FreeRTOS on Cortex-M7 / IMX8MP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FPU crash (probably) using FreeRTOS on Cortex-M7 / IMX8MP

866 Views
BjornJ
Contributor I

We are using FreeRTOS on the Cortex-M7 in a IMX8MP.

It has worked fine for some time until we added math library calls. The math library will use the FPU. Now the M7 has started to crash.

We suspect that it is related to some interrupt handler messing up the math library call.

Reading on forums and source code, it looks like FPU support is available without any special setup in FreeRTOS (for Cortex-M7). Do we need to do something special to activate FPU support? Any other ideas of what might be wrong?

Environment:

IMX8_CM7_SDK_VERSION=MCUX_2.15.000
FreeRTOS version V10.5.1
IMX8MP
 
Relevant compiler and link flags:
We are using 
-mfloat-abi=hard 
-mfpu=fpv5-sp-d16
 
Thanks for your help,
Björn

 

0 Kudos
Reply
3 Replies

796 Views
BjornJ
Contributor I

Thanks for your reply @AldoG 

We got the flags from the NXP example.

Looking more into the compiler flags and reference manual, we came to the conclusion that we should use the compiler flag -mfpu=fpv5-d16, since the IMX8MP has a Cortex-M7 with double precision. With that flag, all our target tests are working and math library calls etc works as expected.

However, should it work with the single precision flag?

With the single precision flag our FPU tests sometimes worked. Moving around the statements in the source code and/or adding debug code sometimes made it work. So it seems to be timing or code layout dependent.

It would be great if you added FPU examples.

Best regards,

Björn

 

0 Kudos
Reply

784 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

According to reference manual both are supported, so I would say it deppends on the application.

Regarding FPU example, I will pass your comments to team.

Best regards/Saludos,
Aldo.

0 Kudos
Reply

814 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

I see no problem with the link flags you have used, even in the SDK FreeRTOS we have the same flags set by default, please have a look at any example code flags.cmake

IF(NOT DEFINED FPU) 
    SET(FPU "-mfloat-abi=hard -mfpu=fpv5-sp-d16") 
ENDIF()

Unfortunately we do not have any samples using FPU, not that I'm aware off.

Best regards/Saludos,
Aldo.

0 Kudos
Reply