2023-03-20 05:19 AM
I have some problems with printf function.
For example,
float valf=0;
printf("%.0f",valf)
The result is
f
I don't understand...I thought that the native printf worked...
The option
Use float with printf is flagged.
Thank you.
2023-03-20 05:37 AM
Do you enabled float output in CubeIDE?
2023-03-20 05:42 AM
Make sure you've provided suitable plumbing code to a UART you have configured and enabled.
In STs GNU/GCC implementation via __io_putchar and called from write()
2023-03-20 05:48 AM
If I write, for example,
printf("TEST %.0f",valf)
the result is
TEST f
if I put the breakpoint in my uart function, the string pointed is "TEST f"
I have no problems with integer...
this for example works correctly
TRACE(("ENDLOG%.2d%.2d%.2d%.2d%.2d%.2d.%d",g_DATEDAY,g_DATEMONTH,g_DATEYEAR,g_TIMEHOURS,g_TIMEMINUTES,g_TIMESECONDS,g_TIMEmSECONDS));
the result is:
ENDLOG010323142500.1
2023-03-20 07:06 AM
In your IDE, compiler configuration, check icon "nano printf" for float variables.
2023-03-20 07:15 AM
2023-03-20 07:15 AM
2023-03-20 09:01 AM
The problem was a writing in flash (I'm using a nucleo-board). How to know the part of the flash you can write to?
2023-03-22 11:09 AM
Learn how the flash memories work and read the reference manual.