[riot-users] Linker | printf | accuracy problems

oliver oliver.koepp at yahoo.de
Wed Jul 31 15:02:27 CEST 2019


Hello RIOT Team,

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 ?


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


More information about the users mailing list