Hello world Ada-example on RaspberryPi

Joel Sherrill joel.sherrill at oarcorp.com
Mon Jul 6 18:27:34 UTC 2015



On 7/6/2015 1:20 PM, Jan Sommer wrote:
> Hi Jerome,
>
> Not sure that I understand what you mean.
>
> Am Montag, 6. Juli 2015, 20:05:13 schrieb Hugues Jérôme:
>> Check this
>>
>> 	https://git.rtems.org/ada-examples/tree/rtems_init.c
>>
>> I wonder whether this setting is BSP setting or not. If always seen this file there ..
>
> That's the file which is used to setup the Ada-main task in the examples.
> If there is a call to delay I would assume that there is a computation like this:
> TICKS_TO_WAIT = DELAY_IN_US / MICROSECONDS_PER_TICK
> Then the thread will suspend for the correct number of TICKS, but somehow this does not seem to work correctly, because it results in delays 10*longer than expected if set to 1000 us per tick and has the correct delay for 10000 us per tick(see below). Question is why? Not sure if that can be a problem with the bsp.

Where is the delay initiated? in Ada code? a POSIX call? or with rtems_task_wake_after()?

The last will get longer because it is measured in clock ticks. The others
should end up doing math.

Ultimately, the run-time translates Ada operations into POSIX calls.

But under the hood, the smallest unit of time for a delay is a clock tick.
So if it is 10 milliseconds, then every delay < that will be 10 milliseconds
or greater.

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.

> Regards,
>
>     Jan
>
>>
>> Regards,
>>
>> Le 6 juil. 2015 à 20:02, Jan Sommer <soja-misc at aries.uberspace.de> a écrit :
>>
>>> Ok, in rtems_init.c
>>>
>>> #define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1)
>>>
>>> causes the 2.5s delay to be 25 s. If I set it to
>>>
>>> #define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
>>>
>>> then the delay will be 2.5 s.
>>> How (or where) is the number of ticks to wait computed when a delay is called in Ada?
>>>
>>> Cheers,
>>>
>>>    Jan
>>>
>>> Am Sonntag, 5. Juli 2015, 23:11:36 schrieb Jan Sommer:
>>>> Hi,
>>>>
>>>> I tried to run the hello_world_ada example on the raspberryPi today and ran into a few issues.
>>>>
>>>> First, there was the linking problem for the function _ada_pthread_minimum_stack_size where is that supposed to be defined?
>>>>
>>>> There is also an issue with the current Makefile.shared in the top level example-directory. The Makefile of the hello_world program adds a define for the stack size to the CFLAGS and later includes the Makefile.shared. However there CFLAGS is set to "" in the beginning effectively deleting the stack size set previosly. I commented this line as well (don't know if it will have side effects in later examples).
>>>>
>>>> The program then linked. Running the program on the Pi worked as well, but with one problem. The Delay of 2.5 s took 25 s. I changed the delay time several times and it always is accurately 10 time the set delay time.
>>>>
>>>> I guess there is some clock setting wrong somewhere? Where would I need to correct that?
>>>>
>>>> Cheers,
>>>>
>>>>    Jan
>>>> _______________________________________________
>>>> users mailing list
>>>> users at rtems.org
>>>> http://lists.rtems.org/mailman/listinfo/users
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at rtems.org
>>> http://lists.rtems.org/mailman/listinfo/users
>>
>
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
>

-- 
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