cancel
Showing results for 
Search instead for 
Did you mean: 

Are there any single precision fpu libraries for stm32f72x?

Mike Rosing
Associate II
Posted on November 27, 2017 at 03:35

Howdy,

I just got the NUCLEO-F722ZE board and have played with it enough to know it will be useful for my home project.  I used the

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software-expansion/x-cube-fpudemo.html

and looked at the disassembly to confirm it can compile floating point with the tool suite I have (TrueStudio).  I have looked over a lot of places but have not found any math libraries for this device - but the chances are really high I don't know where to look.  Are there any single precision libraries which implement trig and exp functions which can link with this processor? 

If not, I'll just write one and put it up here.  I'm just trying to be lazy! 

Thanks,

Mike

#stm32f72 #math-library #fpu
5 REPLIES 5
David SIORPAES
ST Employee
Posted on November 27, 2017 at 10:15

Hello,

you can have a look to ARM's 

http://www.keil.com/pack/doc/CMSIS/DSP/html/index.html

. It includes integer and floating point unit optimized operations for DSP applications.
Posted on November 27, 2017 at 15:23

 ,

 ,

Thanks! , That definitely has way more than I need. , The only thing missing is exp(x) which is not used in DSP, so I can save a lot of time with this library. , The functions

http://www.keil.com/pack/doc/CMSIS/DSP/html/group__sin.html ♯ gae164899c4a3fc0e946dc5d55555fe541

(), ,

http://www.keil.com/pack/doc/CMSIS/DSP/html/group__cos.html ♯ gace15287f9c64b9b4084d1c797d4c49d8

() and ,

http://www.keil.com/pack/doc/CMSIS/DSP/html/group__SQRT.html ♯ ga697d82c2747a3302cf44e7c9583da2e8

() are what I'm looking for.
Posted on November 27, 2017 at 17:14

As I recall GNU/GCC has intrinsics for sinf (__builtin_sinf), powf, expf, etc, so it is apt to in-line rather than pull from a library.

The FPU is relatively lackluster when it comes to transcendental functions. ie it is not an 80x87

The FPU also doesn't hold values with higher intermediate precision, at some point if you understand your required math well you'd be better hand coding something, and keeping things in double precision internally until you export the result. This would require the CM7 built as intended with the FPU-D option.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on November 27, 2017 at 18:11

This particular processor does not have double precision and my application does not need it.  But if I link with -lm, I don't think there is a math.lib with my compiler.   I'm so used to tiny processors not having that automatically, I will see what the tool suite does when I make that request.  If it's builtin then the reason I couldn't find it is because I was looking too far away!

Posted on November 28, 2017 at 01:37

OK, it took me a few tries to get the tool to recognize the library, I just needed to put the letter 'm' in the C/C++ Build->Settings->Tool Settings->C Linker->Libraries.  It is built in!  I followed the assembler for expf() and it is nicely efficient using vfma.f32 for multiply accumulate.  I really like it when things are too easy!!

Thank you both, I'm really glad I asked a dumb question.

Mike