How to add the Idle task to Ada runtime
soja-misc at aries.uberspace.de
Sun Aug 2 17:25:40 UTC 2015
Am Samstag, 1. August 2015, 12:48:09 schrieb Joel Sherrill:
> On 08/01/2015 12:39 PM, Jan Sommer wrote:
> > I managed to get most of the Ada examples running for the raspberry pi.
> > However, there seem to be no default idle task.
> > If you have
> > with Text_IO; use Text_IO;
> > procedure Hello is
> > task Hello_Task;
> > task body Hello_Task is
> > begin
> > delay 5.0;
> > end Hello_Task;
> > begin
> > 
> > null;
> > end Hello;
> > The runtime will be terminated after the body of the procedure  is executed.
> > I think the usual behaviour for Ada would be that instead an idle task is running while the Hello_Task waits.
> > At least it works like this if I compile the file for my desktop-PC.
> None of that is going to help. This is Ada run-time specific. So it is
> some behavior that needs to be accounted for.
> Ada tasks are pthreads on both Linux and RTEMS. One simple thing
> to do would be to check that the pthread attributes are the same on
> the call to pthread_create. I would expect the run-time to be rigorous
> in setting all attributes explicitly but if they don't, then we might be
> missing the attribute that makes a thread joinable.
The thread creation seems to be basically the same on Linux and Rtems.
The thread is created as detached.
> Otherwise, we need to figure out where this is in the run-time and
> see what is going on.
After reading about the threading implementation of gnat here: http://www.iuma.ulpgc.es/users/jmiranda/gnat-rts/node18.htm#task_steps
I looked at the "Complete Master" part. I could find a difference in runtime behaviour in the file /opt/rtems-4.11-pi/lib/gcc/arm-rtems4.11/4.9.3/adainclude/s-tassta.adb
>From line 1704 - 1746 the master is supposed to count the number of active tasks and afterwards in the loop between l. 1755 - 1777 it is supposed to go to sleep (l. 1775) until the number of active tasks is 0.
In Linux this works properly. In Rtems it exits the loop immediately ( exit when Self_ID.Common.Wait_Count = 0; ) and never goes to sleep.
So it appears to me that counting the active tasks fails (i.e. it counts 0 ) somehow. Unfortunately I wasn't able to go deeper.
Most of the temporary variables are optimized out (according to gdb/ddd). I compiled the toolchain with rsb with --targetcflags and targetcxxflags set to "-O0 -g", but still can't print many variables. Is there another trick to have all these variables accessible as well (performance is not an issue)?
> Asking for advice on gcc at gcc.gnu.org might be useful at this point.
> Please cc' me if you do that.
> > Could someone point me in the right direction?
> > Cheers,
> > Jan
> > _______________________________________________
> > users mailing list
> > users at rtems.org
> > http://lists.rtems.org/mailman/listinfo/users
More information about the users