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

Rane ranebalslev at gmail.com
Fri Dec 19 08:04:36 CET 2014


Important observation you got there.  I will check that out as soon as
possible.
On Dec 19, 2014 6:43 AM, "Martin Stoilov" <martin at rpasearch.com> wrote:

> On 12/17/2014 11:54 PM, Martin Stoilov wrote:
>
>> With the nano.spec you still have a way to enable the full version of
>> printf by adding "-u _printf_float" to the link command. This works in the
>> Eclipse arm plugin project, but doesn't work in riot-os, I can not figure
>> out why. Also, I tried to compile without the nano.spec , still doesn't
>> work.
>>
>> -Martin
>>
>> On 12/17/2014 11:41 PM, Martine Lenders wrote:
>>
>>> 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 <mailto:
>>> 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
>>> <mailto: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 <mailto:users at riot-os.org>
>>>         http://lists.riot-os.org/mailman/listinfo/users
>>>
>>>
>>>     _______________________________________________
>>>     users mailing list
>>>     users at riot-os.org <mailto: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
>>>
>>
>> _______________________________________________
>> users mailing list
>> users at riot-os.org
>> http://lists.riot-os.org/mailman/listinfo/users
>>
>>  It looks like this problem is related to thread creation. If I call
> printf from kernel_init it works fine, but if I call it from separate
> thread create with thread_create, float args show up as 0.00000 . I've been
> using riot-os only for about a week, so I don't have too much knowledge
> about the OS internals. If somebody can help me understand of what is going
> on and how I can work around this problem (if possible at all) it will be
> great.
>
> Thanks,
> -Martin
> _______________________________________________
> 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/20141219/748876ed/attachment.html>


More information about the users mailing list