cancel
Showing results for 
Search instead for 
Did you mean: 

How can i implement the math library in the STM32CubeIDE? I use the STM32L011 and i want to implement the atan2(x,y) function. But I can not get a working result....

RPiep.1
Associate
 
2 REPLIES 2
KnarfB
Principal III

No need to implement, it already exists. Add #include <math.h> to your source code and add linker flag -lm That brings in the math lib for gcc.

For the curious: Sources are roughly here: https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libm/math/e_atan2.c

Running floating point on my L011, but not using CubeIDE. ST has a free Keil License for their Cortex-M0(+) devices.

Make sure to enable all options/checkboxes to pull in the appropriate C run-time libraries, including floating point support.

The chips have relatively small Flash, so I'd imagine if you pull in a lot of the transcendental stuff things could get tight.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..