comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Duration for GNAT on ARM
Date: Wed, 24 Dec 2014 00:27:33 +0000
Date: 2014-12-24T00:27:33+00:00	[thread overview]
Message-ID: <lyy4px51u2.fsf@pushface.org> (raw)
In-Reply-To: m7crm7$r9h$1@dont-email.me

"J-P. Rosen" <rosen@adalog.fr> writes:

> Le 23/12/2014 23:42, Dmitry A. Kazakov a écrit :

Actually, it was me.

>> However, if I do this with both GNAT GPL 2014 and FSF GCC 4.9.1
>>> cross-compiling to arm-eabi for the STM32F4 family (Cortex M4), I get
>>> 
>>>    type Duration is delta 0.020
>>>      range -((2 ** 31 - 1) * 0.020) ..
>>>            +((2 ** 31 - 1) * 0.020);
>>>    for Duration'Small use 0.020;
>>> 
>>> I can understand the 32-bit vs 64-bit part - a misguided attempt at
>>> efficiency, perhaps - but who gets to say that the clock runs at 50
>>> Hz?

> Duration'small is not related to the accuracy of the hardware clock,
> it's just the elementary step for time. Ada.Real_Time might be more
> useful for you.

This is for a Ravenscar RTS, so I have to use Ada.Real_Time.

in GNAT, Ada.Real_Time.Time and Time_Span are both new Durations.

I find the "elementary step for time" concept somewhat confusing. I have
a clock which ticks every millisecond, but the 32-bit Standard.Duration,
Ada.Real_Time.Time, and Ada.Real_Time.Time_Span all have the same
granularity of 20 ms!

Oh. AdaCore's arm-eabi Ada.Real_Time works with very low-level stuff to
provide for 50 years of running, and doesn't use Duration. For the
present work, I'm quite happy not to meet that requirement!

It would be good to work out why my clock is running fast by almost a
factor of 2 ...


  reply	other threads:[~2014-12-24  0:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-23 21:21 Duration for GNAT on ARM Simon Wright
2014-12-23 22:42 ` Dmitry A. Kazakov
2014-12-23 22:52   ` J-P. Rosen
2014-12-24  0:27     ` Simon Wright [this message]
2014-12-24  9:40       ` Simon Wright
2014-12-24  0:04   ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox