Electronic – STM32 non floating point unit chips

cortex-mfloating pointmicrocontrollerstm32

I would like to know how STM32F2 chips and below that doesn't handle floating point unit, perform float operation.

I read here, it mentions that the floating point is handled by library functions, but when I am writing my firmware code and I didn't include any library to handle those floating point operations.

Example: if I perform a simple float computation

float gain = 1.2 * 1.5;

I didn't include any external library, but it still able to compute the floating value? Or when I compiling, the compiler will handle it automatically for me?

Best Answer

In the quote, there is no runtime fp computation, it is made by preprocessor and included to code as a literal. If there would be a computation, it would be handled by compiler low level libraries, which in the case of GCC, you would see fp functions fused into the final binary from one particular version of libgcc.a, depending of hard/soft fp usage. Here on my system there are two versions of libgcc.a for cortex-m4:

/usr/lib/gcc/arm-none-eabi/5.3.0/armv7e-m/softfp/libgcc.a
/usr/lib/gcc/arm-none-eabi/5.3.0/armv7e-m/fpu/libgcc.a

notice: libgcc.a is not only about fp.