I'm programming on a STM32F437. I'm using SafeRTOS. The compiler is GCC.
In one task I'm using snprintf()
to prepare a string with values.
The problem is that the snprintf()
fails to handle floating point numbers. It just ends the resulting string (with '\0'
) when it reaches any %f
or %g
in the formatting string.
But, and this is strange. The snprintf()
in the task works with no problem if I add a dummy call to snprintf()
in main()
before starting the RTOS.
The dummy call:
char dummy[20];
snprintf(dummy, sizeof(dummy), "%g", 3.14159);
I found a similar solution here
But no answer why it works.
Any ideas what is going on?