<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:10pt"><DIV style="FONT-SIZE: 10pt; FONT-FAMILY: arial, helvetica, sans-serif">Joel,</DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: arial, helvetica, sans-serif"><BR>Thanks for the detailed answer. Two short questions:</DIV>
<OL>
<LI>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: arial, helvetica, sans-serif">Where can I see the wrapper task and how it is initialized (i.e. is the elaboration code executed in the wrapper task after RTEMS was started)?</DIV></LI>
<LI>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: arial, helvetica, sans-serif">How do I build the posix tests on PSIM so that I can run them?</DIV></LI></OL>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: arial, helvetica, sans-serif">Thanks</DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: arial, helvetica, sans-serif">Avy<BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">----- Original Message ----<BR>From: Joel Sherrill <joel.sherrill@oarcorp.com><BR>To: avy st <astrominger@yahoo.com><BR>Cc: RTEMS mailing list <rtems-users@rtems.org><BR>Sent: Tuesday, February 13, 2007 8:21:18 PM<BR>Subject: Re: RTEMS Ada Questions<BR><BR>
<DIV>avy st wrote:<BR>> Hello all,<BR>> <BR>> After successfully building powerpc-rtems-4.7 Ada capable toolset on <BR>> Cygwin host and rtems-4-7-branch itself (or at least so I hope, since <BR>> no Ada program was run yet), I've tried compiling and running the <BR>> following Ada 'hello' program, appearing on the Ada and RTEMS wiki <BR>> page (<A href="http://www.rtems.com/wiki/index.php/RTEMSAda" target=_blank>http://www.rtems.com/wiki/index.php/RTEMSAda</A>):<BR>><BR>> $ 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 <BR>><BR>> Running it, on the PSIM BSP, resulted in internal error after
program end. Joel Sherrill looked at it, and suspected that <BR>> it was a stack overrun after program end.<BR><BR>psim has a pretty powerful (and underdocumented) debug trace facility. <BR>Modify whatever<BR>script you are using to add the following line to what the RTEMS script <BR>psim/psim-gdb<BR>calls TREE_FILE.<BR><BR>/openprom/trace/semantics 1<BR><BR>This will cause psim to print every instruction as it executes it and <BR>should tell you<BR>precisely how far you are getting no matter how poor any other debug info<BR>is.<BR><BR>Attached is my hacked script to call powerpc-rtems4.7-run with this <BR>option enabled.<BR><BR><BR>> However, having a look at RTEMS Ada hello example and the elaboration code, I saw that, in my opinion, RTEMS was not even <BR>> started, and no task was created when building the program as described on the Wiki page. All RTEMS Ada examples<BR>> EXPLICITLY create the tasks and start RTEMS on their
main, which is not the case in this examples.<BR>> So, here are the<BR>> questions:<BR>><BR>> 1. Is my observation correct?<BR>><BR><BR>The above trace option will show that.<BR>><BR>> 1. If so, is there a way to create the environment task<BR>> 'automatically' (from the Ada code point of view), and run the<BR>> Ada main<BR>> procedure in the context of the environment task automatically,<BR>> as is required and done bu all the Ada environments<BR>> that I've worked with?<BR>><BR>Yes. When things are all running, the RTEMS wrapper task for gnat_main <BR>will make this happen.<BR>><BR>> 1. What about defining tasks in Ada - defining a task type and
an<BR>> object of that type? Would this automatically create a task<BR>> as it should? Is Ada task=RTEMS task?<BR>><BR>Each Ada task == an RTEMS POSIX thread created by pthread_create just <BR>like the GNU/Linux port.<BR>><BR>> 1. Is all this behavior documented anywhere?<BR>><BR>Only in the source. Most of the assumptions are from GNAT's run-time. <BR>We just wrap their gnat_main<BR>as needed and map their calls to POSIX thread calls.<BR><BR>Just to be sure, can you run the RTEMS posix tests on your psim build?<BR><BR>--joel<BR>> Thanks<BR>> Avy<BR>> <BR>> <BR>> <BR>> <BR>> <BR>> <BR>> <BR>> ------------------------------------------------------------------------<BR>><BR>> _______________________________________________<BR>>
rtems-users mailing list<BR>> rtems-users@rtems.com<BR>> <A href="http://rtems.rtems.org/mailman/listinfo/rtems-users" target=_blank>http://rtems.rtems.org/mailman/listinfo/rtems-users</A><BR>></DIV>
<DIV>#! /bin/sh<BR>#<BR># Shell script to ease invocation of the powerpc simulator<BR>#<BR># COPYRIGHT (c) 1989-2006.<BR># On-Line Applications Research Corporation (OAR).<BR>#<BR># The license and distribution terms for this file may be<BR># found in found in the file LICENSE in this distribution or at<BR># <A href="http://www.rtems.com/license/LICENSE" target=_blank>http://www.rtems.com/license/LICENSE</A>.<BR>#<BR># $Id: psim,v 1.10 2006/01/20 17:30:39 joel Exp $<BR>#<BR><BR>TREE_FILE=psim_tree.${LOGNAME}<BR>RUN=powerpc-rtems4.7-run<BR><BR><BR>progname=${0##*/} # fast basename hack for ksh, bash<BR><BR>USAGE=\<BR>"usage: $progname [ -opts ] test [ test ... ]<BR> -v -- verbose<BR> -l limit -- specify time limit (default is 'no
limit')<BR>"<BR><BR># log an error to stderr<BR>prerr()<BR>{<BR> echo "$*" >&2<BR>}<BR><BR>fatal() {<BR> [ "$1" ] && prerr $*<BR> prerr "$USAGE"<BR> exit 1<BR>}<BR><BR>warn() {<BR> [ "$1" ] && prerr $*<BR>}<BR><BR>#<BR># process the options<BR>#<BR># defaults for getopt vars<BR>#<BR><BR>verbose=""<BR>limit="0"<BR><BR>while getopts vl: OPT<BR>do<BR> case "$OPT" in<BR> v)<BR> verbose="yes";;<BR> l)<BR> limit="$OPTARG";;<BR> *)<BR> fatal;;<BR> esac<BR>done<BR>shiftcount=`expr $OPTIND
- 1`<BR>shift $shiftcount<BR><BR>args=$*<BR><BR># RUN_DEBUG="-t sem_device"<BR><BR># Build this user's device tree file<BR>echo "/#address-cells 2" > ${TREE_FILE}<BR>echo "/openprom/init/register/pvr 0xfffe0000" >> ${TREE_FILE}<BR>echo "/openprom/options/oea-memory-size 8388608" >> ${TREE_FILE}<BR>echo "/openprom/trace/semantics 1" >> ${TREE_FILE}<BR><BR># These require the semaphore and shared memory device models.<BR># echo "/shm@0xc0000000/reg 0xc0000000 0x10000" >> ${TREE_FILE}<BR># echo "/shm@0xc0000000/key
${RTEMS_SHM_KEY}" >> ${TREE_FILE}<BR># echo "/sem@0xc0010000/reg 0xc0010000 12" >> ${TREE_FILE}<BR># echo "/sem@0xc0010000/key ${RTEMS_SHM_SEMAPHORE_KEY}" >> ${TREE_FILE}<BR># echo "/sem@0xc0010000/value -1" >> ${TREE_FILE}<BR><BR>runtest()<BR>{<BR> testname=${1}<BR> max_run_time=${2}<BR> if [ ${max_run_time} -eq 0 ] ; then<BR> #echo run ${testname} forever<BR> ${RUN} -f ${TREE_FILE} ${RUN_DEBUG} ${testname}<BR> else<BR> #echo run ${testname} for maximum ${max_run_time} seconds<BR> ${RUN} -f ${TREE_FILE} ${RUN_DEBUG} ${testname}
&<BR> pid=$!<BR><BR> # Make sure it won't run forever...<BR> time_run=0<BR> while [ $time_run -lt $max_run_time ]<BR> do<BR> # sleep 5s at a time waiting for job to finish or timer to expire<BR> # if job has exited, then we exit, too.<BR> sleep 1<BR> kill -0 $pid 2> /dev/null<BR> running=$?<BR> if [ $running -eq 0 ] ; then<BR> time_run=$((time_run + 5))<BR> if [ $time_run -ge $max_run_time ]; then<BR> kill -9 $pid 2>
/dev/null<BR> ran_too_long="yes"<BR> echo "${testname} killed after running ${max_run_time} seconds"<BR> fi<BR> else<BR> ran_too_long="no"<BR> break<BR> fi<BR> done<BR> fi<BR>}<BR><BR>if [ "X${1}" = "X" ] ; then<BR> echo no tests to run<BR> exit 1<BR>fi<BR>runtest ${1} ${limit}<BR>rm -f ${TREE_FILE}<BR>exit $?</DIV></DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: arial, helvetica, sans-serif"><BR></DIV></div></body></html>