hello
i cant print float numbers the float number stays empty
float temp;
temp = 24.123;
sprintf((char*)tx_buffer,"n=%f\n",temp);
i have included "string.h" and "stdio.h"
what could be the problem?
float printing
Moderators: Markus Girdland, Mattias Norlander
Re: float printing
I suggest you to use this library, it's better than using -u _printf_float linker script flag. ( “-u _printf_float” in your project properties:
Properties -> C/C++ Build -> Settings -> Linker -> Miscellaneous -> Linker flags )
https://github.com/mpaland/printf
Properties -> C/C++ Build -> Settings -> Linker -> Miscellaneous -> Linker flags )
https://github.com/mpaland/printf
Re: float printing
hi
thank you for your answer
i an new with attolic and and didnt understal completly how to use the information you gave .
the miscellaneus in the linker is empty
these are the flags i found in the linker
-mthumb -mcpu=cortex-m0 -T"../STM32F072C8_FLASH.ld" -specs=nosys.specs -static "-Wl,-Map=${BuildArtifactFileBaseName}.map" -Wl,--gc-sections -Wl,--defsym=malloc_getpagesize_P=0x80 -Wl,--start-group -lc -lm -Wl,--end-group -specs=nano.specs
please provide more information how to use your recomendation lib
thank you
nati
thank you for your answer
i an new with attolic and and didnt understal completly how to use the information you gave .
the miscellaneus in the linker is empty
these are the flags i found in the linker
-mthumb -mcpu=cortex-m0 -T"../STM32F072C8_FLASH.ld" -specs=nosys.specs -static "-Wl,-Map=${BuildArtifactFileBaseName}.map" -Wl,--gc-sections -Wl,--defsym=malloc_getpagesize_P=0x80 -Wl,--start-group -lc -lm -Wl,--end-group -specs=nano.specs
please provide more information how to use your recomendation lib
thank you
nati
Re: float printing
hi all
by adding this line :-u _printf_float
to the linker
the float works
-mthumb -mcpu=cortex-m0 -T"../STM32F072C8_FLASH.ld" -specs=nosys.specs -static -u _printf_float "-Wl,-Map=${BuildArtifactFileBaseName}.map" -Wl,--gc-sections -Wl,--defsym=malloc_getpagesize_P=0x80 -Wl,--start-group -lc -lm -Wl,--end-group -specs=nano.specs
thank you
by adding this line :-u _printf_float
to the linker
the float works
-mthumb -mcpu=cortex-m0 -T"../STM32F072C8_FLASH.ld" -specs=nosys.specs -static -u _printf_float "-Wl,-Map=${BuildArtifactFileBaseName}.map" -Wl,--gc-sections -Wl,--defsym=malloc_getpagesize_P=0x80 -Wl,--start-group -lc -lm -Wl,--end-group -specs=nano.specs
thank you
Return to “TrueSTUDIO for STM32 discussions”
Who is online
Users browsing this forum: No registered users and 2 guests