Hello world Ada-example on RaspberryPi

Joel Sherrill joel.sherrill at oarcorp.com
Tue Jul 7 19:10:42 UTC 2015



On 7/7/2015 1:43 PM, Jan Sommer wrote:
> Am Montag, 6. Juli 2015, 13:27:34 schrieb Joel Sherrill:
>>
>> Just to make sure the math in the Pi clock driver is OK, it would be
>> a good idea to change the microseconds per tick value in the ticker
>> sample. If it stays true to running ~30 seconds, then the math is right
>> in the driver. If it doesn't remain true to "real world" time, then
>> the math in the Pi clock driver may be wrong.
>>
>
> The ticker example all use the classic rtems API where you delay a certain number of ticks (if I am not mistaken).
> Anyways I checked out the implementation of gnat for delay until and they use nanosleep.
> Based on the posix_examples from examples-v2 I made a short test for nanosleep which tries sleeps for 10s (attached):
>
> The results are:
> If CONFIGURE_MICROSECONDS_PER_TICK is not defined:  sleeps for 10 s.
> If  CONFIGURE_MICROSECONDS_PER_TICK = RTEMS_MILLISECONDS_TO_MICROSECONDS(1): sleeps for 100 s
> If  CONFIGURE_MICROSECONDS_PER_TICK = RTEMS_MILLISECONDS_TO_MICROSECONDS(10): sleeps for 10 s
> If  CONFIGURE_MICROSECONDS_PER_TICK = RTEMS_MILLISECONDS_TO_MICROSECONDS(100): sleeps for 1 s
>
> Where do I find the clock driver for the Pi? I am not sure if it is not too low level for me, but I can take a look.

c/src/lib/libbsp/arm/raspberrypi/clock/clockdrv.c

And I think I can point to the problem. raspberrypi_clock_initialize()
looks like it is putting hard coded numbers into the various registers.
My guess is that the BCM2835_TIME_LOD and BCM_TIMER_RLD should be
set to a number that is calculated based on the value of
rtems_configuration_get_microseconds_per_tick() instead of (10000 - 1).

Ask more questions as you need to.

Good find.

> Cheers,
>
>     Jan
>

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985


More information about the users mailing list