RTEMS Ada Questions

Joel Sherrill joel.sherrill at oarcorp.com
Tue Feb 13 18:21:18 UTC 2007

avy st wrote:
> Hello all,
>   After successfully building powerpc-rtems-4.7 Ada capable toolset on 
> Cygwin host and rtems-4-7-branch itself (or at least so I hope, since 
> no Ada program was run yet), I've tried compiling and running the 
> following Ada 'hello' program,  appearing on the Ada and RTEMS wiki 
> page (http://www.rtems.com/wiki/index.php/RTEMSAda):
>     $ cat t.adb  with Ada.Text_IO;  procedure T is  begin     Ada.Text''IO.Put''Line ("Hello RTEMS Ada");  end T;  $ powerpc-rtems-gnatmake -f -g t -largs -BINSTALL -specs bsp_specs -qrtems  ...  $ INSTALL/powerpc-rtems/psim/tests/runtest ./t  
> Running it, on the PSIM BSP, resulted in internal error after program end.  Joel Sherrill looked at it, and suspected that 
> it was a stack overrun after program end.

psim has a pretty powerful (and underdocumented) debug trace facility.  
Modify whatever
script you are using to add the following line to what the RTEMS script 
calls TREE_FILE.

/openprom/trace/semantics 1

This will cause psim to print every instruction as it executes it and 
should tell you
precisely how far you are getting no matter how poor any other debug info

Attached is my hacked script to call powerpc-rtems4.7-run with this 
option enabled.

> However, having a look at RTEMS Ada hello example and the elaboration code, I saw that, in my opinion, RTEMS was not even 
> started, and no task was created when building the program as described on the Wiki page.  All RTEMS Ada examples
> EXPLICITLY create the tasks and start RTEMS on their main, which is not the case in this examples.
> So, here are the
>  questions:
>    1. Is my observation correct?

The above trace option will show that.
>    1. If so, is there a way to create the environment task
>       'automatically' (from the Ada code point of view), and run the
>       Ada main
>       procedure in the context of the environment task automatically,
>       as is required and done bu all the Ada environments
>       that I've worked with?
Yes.  When things are all running, the RTEMS wrapper task for gnat_main 
will make this happen.
>    1. What about defining tasks in Ada - defining a task type and an
>       object of that type? Would this automatically create a task
>       as it should? Is Ada task=RTEMS task?
Each Ada task == an RTEMS POSIX thread created by pthread_create just 
like the GNU/Linux port.
>    1. Is all this behavior documented anywhere?
Only in the source.  Most of the assumptions are from GNAT's run-time.  
We just wrap their gnat_main
as needed and map their calls to POSIX thread calls.

Just to be sure, can you run the RTEMS posix tests on your psim build?

> Thanks
> Avy
> ------------------------------------------------------------------------
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: psim-4.7
URL: <http://lists.rtems.org/pipermail/users/attachments/20070213/73de5b8c/attachment-0001.ksh>

More information about the users mailing list