2026-01-06 12:54 AM - last edited on 2026-01-06 2:08 AM by Andrew Neil
I am working on STM32H753 (with eval board EVAL 2).
I am modifying an existing firmware built without libc and without startup files.
I need to convert floating point variables to strings, so I want to use as little as libc as possible. I choosed newlib-nano for memory size.
I compiled with `-mfpu=fpv5-d16 -mfloat-abi=hard -specs=nano.specs ...` and linked with `-mfpu=fpv5-d16 -mfloat-abi=hard -specs=nosys.specs -specs=nano.specs -u _printf_float -nostartfiles ...`
I also added the definition of symbols required by the libc and reserved a memory area for the heap.
I tried to write a string from a double variable with the following code (it's code for debug only, I know it may overflow the char array depending on float value):
char my_string[64];
double my_double = 1.3;
sprintf(my_string, "%.3f", my_double);But the content of the string (checked by dumping the memory on debugger) is `1300` and not `1.300`
(i tried with different values and format specifiers)
Am I missing something ?
2026-01-06 1:14 AM
What is the version of the toolchain?
2026-01-06 2:16 AM
Sorry, it is arm-none-eabi-gcc 10.2.0
2026-01-06 2:18 AM
Hello @Gpeti
Are you using STM32CubeIDE?
2026-01-06 2:21 AM
No. I build with make and gcc and I load and debug with Lauterbach trace32