Hi,

On 8/5/19 2:57 AM, Philipp Blum wrote:
> Can somebody explain, why it increases the size so much? I have a rough
> idea, but would be nice to get an explanation :)

printf_float also enables double printf support, and because they are
always referenced by printf through the format specifier handler, that
cannot be garbage collected.

Double arithmetic is mostly done in software, and in a standard
compliant way (IEEE754?), so that's expensive.

Here's what's added by just adding USEMODULE += printf_float to hello_world:

https://gist.github.com/7eb71763f81908a2d0f8f90f94ac63c5

Kaspar

> 
> Am 2019-08-04 15:38, schrieb Alexandre Abadie:
> 
>> Hi Oliver,
>>
>> See my answer about printf below. I'm not enough expert with timer
>> accuracy but there are known issues with xtimer, maybe have a look at
>> related issues/PRs on github ?
>>
>> ----- Le 31 Juil 19, à 15:02, oliver [email protected]
>> <mailto:[email protected]> a écrit :
>>
>>> 1 Question:
>>>
>>> I try to calculate some floating point digits on the SAMR21-xpro Board.
>>> When I print the floating point digit it shows me nothing.
>>>
>>> My Code:
>>> =================================================================
>>> uint32_t time_diff = 554;
>>>
>>> double distance = (33./2000.) * time_diff;
>>> printf("distance = %f cm\n",distance);
>>> =================================================================
>>>
>>> Output:
>>> =================================================
>>> 2019-07-31 14:36:58,631 - INFO # distance =  cm
>>> =================================================
>>>
>>> Stack Overflow [1] tells me that floating point are disabled by default
>>> on arm-gcc.
>>> Whats the trick ??
>>> What should I add to the Makefile ?
>>
>> Just add USEMODULE += printf_float to your application Makefile.
>> Note that this will noticeably increase the generated firmware size.
>>
>> Alex
>>
>>>
>>>
>>> 2. Question:
>>>
>>> If I try to print (using printf) uint64_t variables I have the some
>>> problem as above.
>>>
>>>
>>> 3. Question:
>>>
>>> How precise is the current system time on RIOT ??
>>> I set a GPIO HIGH and LOW with a time difference of 100 and less
>>> microseconds. Before I set the GPIO HIGH and LOW, I call function [2].
>>> If I compare the time with an oscilloscope I get horrible deviations.
>>> What is the best way to measure microseconds and on RIOT with the
>>> highest accuracy.
>>>
>>>
>>>
>>>
>>> [1]
>>> https://stackoverflow.com/questions/12703307/arm-none-eabi-gcc-printing-float-number-using-printf#25723994
>>> [2]    static uint32_t xtimer_now_usec()
>>>
>>>
>>> --
>>> Best Regards
>>>
>>> Oliver Koepp
>>> _______________________________________________
>>> users mailing list
>>> [email protected] <mailto:[email protected]>
>>> https://lists.riot-os.org/mailman/listinfo/users
>> _______________________________________________
>> users mailing list
>> [email protected] <mailto:[email protected]>
>> https://lists.riot-os.org/mailman/listinfo/users
> 
>  
> 
>  
> 
> _______________________________________________
> users mailing list
> [email protected]
> https://lists.riot-os.org/mailman/listinfo/users
> 
_______________________________________________
users mailing list
[email protected]
https://lists.riot-os.org/mailman/listinfo/users

Reply via email to