[riot-users] printf float on stm32f4 with toolchain arm-none-eabi-gcc

Martine Lenders authmillenon at gmail.com
Thu Dec 18 08:41:34 CET 2014


Hello Martin, Hello Rane,
All the stm32f4 boards are build with nano specs, if your toolchain
supports them. This means among others, that the printf is very basic (to
save flash and RAM during execution) and can't print types like e.g. floats
and long longs. If you do not want this, you have to compile without nano
specs with the caveat of a larger memory footprint + more stack consumption
of threads that use printf (on current master (695d702) for
stm32f4discovery, but for other boards the diff would be similar):

diff --git a/boards/stm32f4discovery/Makefile.include
> b/boards/stm32f4discovery/Makefile.include
> index cecaf4c..31869c4 100644
> --- a/boards/stm32f4discovery/Makefile.include
> +++ b/boards/stm32f4discovery/Makefile.include
> @@ -45,10 +45,5 @@ export TERMFLAGS += -p "$(PORT)"
>  export CXXUWFLAGS +=
>  export CXXEXFLAGS +=
>
> -# use newLib nano-specs if available
> -ifeq ($(shell $(LINK) -specs=nano.specs -E - 2>/dev/null >/dev/null
> </dev/null ; echo $$?),0)
> -export LINKFLAGS += -specs=nano.specs -lc -lnosys
> -endif
> -
>  # export board specific includes to the global includes-listing
>  export INCLUDES += -I$(RIOTBOARD)/$(BOARD)/include


Hope this was helpful,
Martine

2014-12-18 8:00 GMT+01:00 Rane <ranebalslev at gmail.com>:
>
> The issue is with the samr21. But you can do math with floats though with
> bad performance because of no fpu available.  The debug or printf does not
> print anything.  You can cast only
> On Dec 18, 2014 6:44 AM, "Martin Stoilov" <martin at rpasearch.com> wrote:
>
>> Hello,
>>
>> I have a problem to use printf with float arguments - it always outputs
>> 0.00000 for the float arguments. Greping through the code I see this
>> scenario is used in other platforms. If somebody could give me any pointers
>> how to fix this or where to look, I will highly appreciate it.
>>
>> Best Regards,
>> -Martin
>> _______________________________________________
>> users mailing list
>> users at riot-os.org
>> http://lists.riot-os.org/mailman/listinfo/users
>>
>
> _______________________________________________
> users mailing list
> users at riot-os.org
> http://lists.riot-os.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/users/attachments/20141218/50ad0717/attachment.html>


More information about the users mailing list