Skip to main content
NOza.1
Associate
June 18, 2020
Question

Float value gives hard fault in STMCubeIDE

  • June 18, 2020
  • 3 replies
  • 1277 views

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

This topic has been closed for replies.

3 replies

TDK
Super User
June 18, 2020

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
NOza.1Author
Associate
June 18, 2020

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