How to add the Idle task to Ada runtime

Joel Sherrill joel.sherrill at oarcorp.com
Sat Aug 1 17:48:09 UTC 2015


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
> 	[1]
> 	null;
> end Hello;
>
> The runtime will be terminated after the body of the procedure [1] 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.
>
This may be a change in the Ada run-time behavior since when the port
was initially done. As I recall, all Ada tasks had to terminate including
your Hello_Task before control returned to the main thread.

If I am thinking correctly, using the C thread that invoked gnat_main()
as an idle thread wouldn't work because "end hello;" logically is the
point at which the program terminates.
> I found some configuration options in the RTEMS Ada user manual dealing with idle tasks, but it looks to me that it is only relevant if I would like to overwrite the default one with a bsp or application specific one.
> I tried to look at some other bsps (e.g. Leon2) for reference, but haven't found anything useful yet.
>
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.

Otherwise, we need to figure out where this is in the run-time and
see what is going on.

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


-- 
-- Joel Sherrill
Ask me about RTEMS: a free RTOS
Support and Training Available




More information about the users mailing list