cancel
Showing results for 
Search instead for 
Did you mean: 

Float value gives hard fault in STMCubeIDE

NOza.1
Associate II

Hi,

I am using a STM32F4/STM32L4 MCU and STMCube IDE (1.3.0) for the development. It gives ma a hard fault when I print float values.

float value = 3.14f;
printf("Value: %f\r\n", value);

I have enable -u _printf_float as mentioned in attached image. Will you please help me to resolve the issue?

0693W000001r1wzQAA.png

3 REPLIES 3
TDK
Guru

So you can use floats, but the hard fault occurs when using printf with floats?

printf uses malloc, might be malloc failing.

Where is your printf sending data?

If you feel a post has answered your question, please click "Accept as Solution".
NOza.1
Associate II

Que: So you can use floats, but the hard fault occurs when using printf with floats?

Ans: Correct.

Que: Where is your printf sending data?

Ans: UART