<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 27 June 2014 12:41, Joel Sherrill <span dir="ltr"><<a href="mailto:joel.sherrill@oarcorp.com" target="_blank">joel.sherrill@oarcorp.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><div><div>
<br>
<div>On 6/27/2014 9:44 AM, Martínez, Pablo
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On 26 June 2014 18:54, Joel Sherrill
<span dir="ltr"><<a href="mailto:joel.sherrill@oarcorp.com" target="_blank">joel.sherrill@oarcorp.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>
<div> <br>
<div>On 6/26/2014 4:48 PM, Martínez, Pablo wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On 26 June 2014
18:28, Chris Johns <span dir="ltr"><<a href="mailto:chrisj@rtems.org" target="_blank">chrisj@rtems.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>On 26/06/2014 11:54 pm, Martínez,
Pablo wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div> <br>
<br>
<br>
On 26 June 2014 08:37, Chris Johns
<<a href="mailto:chrisj@rtems.org" target="_blank">chrisj@rtems.org</a><br>
</div>
<div> <mailto:<a href="mailto:chrisj@rtems.org" target="_blank">chrisj@rtems.org</a>>>
wrote:<br>
<br>
<br>
<br>
On 26/06/2014 12:56 am, Martínez,
Pablo wrote:<br>
<br>
Hi,<br>
<br>
Im having troubles trying to
use the class rtemsTask from the the<br>
librtems++.<br>
<br>
(<br>
</div>
<a href="https://github.com/atgreen/__RTEMS/blob/master/c/src/__librtems%2B%2B/include/rtems%__2B%2B/rtemsTask.h" target="_blank">https://github.com/atgreen/__RTEMS/blob/master/c/src/__librtems%2B%2B/include/rtems%__2B%2B/rtemsTask.h</a>
<div> <br>
<<a href="https://github.com/atgreen/RTEMS/blob/master/c/src/librtems%2B%2B/include/rtems%2B%2B/rtemsTask.h" target="_blank">https://github.com/atgreen/RTEMS/blob/master/c/src/librtems%2B%2B/include/rtems%2B%2B/rtemsTask.h</a>><br>
)<br>
<br>
This class is basically a
wrapper for the rtems task api.<br>
<br>
I can create the task
successfully (its returns 0), but when
I call<br>
start() the entry point origin
doesnt start despite returning 0<br>
(this<br>
method just write a memory
position to check if the task is<br>
working).<br>
<br>
<br>
const rtems_status_code
rtemsTask::start(const<br>
rtems_task_argument arg)<br>
<br>
<br>
{<br>
if (owner)<br>
<br>
<br>
{<br>
argument = arg;<br>
<br>
<br>
// pass the this pointer as
the argument<br>
</div>
set_status_code(rtems_task___start(id,<br>
origin,<br>
(rtems_task_argument) this));<br>
<br>
<br>
}<br>
else<br>
set_status_code(RTEMS_NOT___OWNER_OF_RESOURCE);
<div><br>
return last_status_code();<br>
<br>
<br>
}<br>
<br>
Any help?<br>
<br>
<br>
Are the priorities ok ? If not it
might not be able to run.<br>
<br>
<br>
Im using this parameters to create the
task:<br>
<br>
"SELF"<br>
1 (priority)<br>
RTEMS_MINIMUM_STACK_SIZE<br>
RTEMS_NO_PREEMPT<br>
0<br>
RTEMS_NO_FLOATING_POINT<br>
RTEMS_LOCAL<br>
<br>
<br>
In C implementation is working fine,
but the problem comes with C++.<br>
<br>
</div>
</blockquote>
<br>
I would need a more complete example to
know what is happening.<br>
<br>
</blockquote>
<div><br>
</div>
<div>Chris,<br>
<br>
</div>
<div>Im trying to use the rtems++ library as
follows:<br>
</div>
<div><br>
<br>
//////////////Tempo.h<br>
<br>
#ifndef TEMPO_H_<br>
#define TEMPO_H_<br>
<br>
#include <rtems++/rtemsTask.h><br>
#include <rtems++/rtemsTaskMode.h><br>
<br>
class Tempo: public rtemsTask<br>
{<br>
public:<br>
Tempo(const char* name,<br>
const rtems_task_priority
initial_priority,<br>
const uint32_t stack_size,<br>
const rtems_mode preemption =
RTEMS_NO_PREEMPT,<br>
const rtems_mode timeslice =
RTEMS_NO_TIMESLICE,<br>
const rtems_mode asr =
RTEMS_NO_ASR,<br>
const rtems_interrupt_level
interrupt_level = 0,<br>
const FloatingPoint
floating_point = fpoff,<br>
const Scope scope = local);<br>
<br>
virtual ~Tempo();<br>
//rtems_task
origin(rtems_task_argument argument);<br>
<br>
const rtems_status_code start(const
rtems_task_argument argument);<br>
static rtems_task
origen(rtems_task_argument argument);<br>
void cuerpo(rtems_task_argument
argument);<br>
<br>
private:<br>
<br>
// task name<br>
rtems_name name;<br>
char name_str[5];<br>
<br>
// owner, true if this object owns
the task<br>
// will delete the task when it
destructs<br>
bool owner;<br>
<br>
// the rtems id, object handle<br>
rtems_id id;<br>
<br>
// the argument for the task, this
class uses the actual argument<br>
// passed to RTEMS<br>
rtems_task_argument argument;<br>
<br>
};<br>
<br>
#endif /* TEMPO_H_ */<br>
<br>
<br>
</div>
<div>//////////////Tempo.cpp<br>
</div>
<div><br>
#include "Tempo.h"<br>
<br>
Tempo::Tempo(const char* tname,<br>
const
rtems_task_priority initial_priority,<br>
const uint32_t
stack_size,<br>
const rtems_mode
preemption,<br>
const rtems_mode
timeslice,<br>
const rtems_mode asr,<br>
const
rtems_interrupt_level interrupt_level,<br>
const FloatingPoint
floating_point,<br>
const Scope scope)<br>
: name(rtems_build_name('S', 'E', 'L',
'F')),<br>
owner(true),<br>
id(RTEMS_SELF),<br>
argument(0)<br>
{<br>
strcpy(name_str, "SELF");<br>
create(tname,<br>
initial_priority,<br>
stack_size,<br>
preemption,<br>
timeslice,<br>
asr,<br>
interrupt_level,<br>
floating_point,<br>
scope);<br>
}<br>
<br>
<br>
Tempo::~Tempo()<br>
{<br>
}<br>
<br>
<br>
const rtems_status_code Tempo::start(const
rtems_task_argument arg)<br>
{<br>
<br>
argument = arg;<br>
// pass the this pointer as the
argument<br>
set_status_code(rtems_task_start(id,origen,(rtems_task_argument)
this));<br>
<br>
printf (" ---Tempo::start ---
\n\n");<br>
<br>
return last_status_code();<br>
}<br>
<br>
<br>
rtems_task
Tempo::origen(rtems_task_argument
argument)<br>
{<br>
</div>
<div> //just for debugging:<br>
</div>
<div> unsigned *regout;<br>
regout= (unsigned*)0x80000d04;<br>
(*regout)=0x12345678;<br>
<br>
printf (" --- Tempo::origen ---
\n\n");<br>
<br>
Tempo *task = (Tempo*) argument;<br>
task->cuerpo(task->argument);<br>
<br>
}<br>
<br>
void Tempo::cuerpo(rtems_task_argument )<br>
{<br>
printf (" --- Tempo::do sth ---
\n\n");<br>
}<br>
<br>
<br>
::::::::::<br>
<br>
" ---Tempo::start --- \n\n" gets
printed, but origen() is not triggered.<br>
<br>
<br>
</div>
<div>Trying to solve this out, Im trying
with one solution I just found (from you!)
<br>
</div>
<div>You use a thread template. I just found
it so I haven't tested it yet.<br>
</div>
<div><br>
<a href="http://comments.gmane.org/gmane.os.rtems.user/20625" target="_blank">http://comments.gmane.org/gmane.os.rtems.user/20625</a><br>
<br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</div>
</div>
This is still not complete. There has to be an
initialization task and<br>
some RTEMS configuration (e.g. CONFIGURE_xxx followed by<br>
an include of <rtems/confdefs.h>).<br>
<br>
My first guess is that you have an Init task at priority
1 sitting<br>
in a loop watching for something to happen. It won't
happen<br>
because it never yields the processor. <br>
<br>
An alternative is that the Init() task falls off the
bottom of its<br>
body and this is a fatal error halting the system. <br>
<br>
If we saw the Init() and configuration that goes with
this<br>
it would really help. Something invokes your Tempo<br>
constructor.<br>
<br>
--joel
<div><br>
</div>
</div>
</blockquote>
<div><br>
#define CONFIGURE_INIT<br>
<br>
#include <rtems.h><br>
#include <rtems++/rtemsTask.h><br>
#include <rtems++/rtemsTaskMode.h><br>
#include
</opt/rtems-4.10/sparc-rtems4.10/leon3/lib/include/bsp.h>
/* for device driver prototypes */<br>
#include <tmacros.h><br>
<br>
extern "C"<br>
{<br>
rtems_task Init(<br>
rtems_task_argument argument<br>
);<br>
}<br>
<br>
<br>
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER<br>
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER<br>
#define CONFIGURE_MAXIMUM_TASKS 10<br>
<br>
#define CONFIGURE_MAXIMUM_TIMERS 5<br>
#define CONFIGURE_MAXIMUM_SEMAPHORES 5<br>
<br>
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE<br>
#define CONFIGURE_INIT_TASK_STACK_SIZE (6 *
RTEMS_MINIMUM_STACK_SIZE)<br>
#define CONFIGURE_EXTRA_TASK_STACKS (13 *
RTEMS_MINIMUM_STACK_SIZE)<br>
//#include
</opt/rtems-4.10/sparc-rtems4.10/leon3/lib/include/rtems/confdefs.h><br>
#include <rtems/confdefs.h><br>
<br>
#include "Tempo.h"<br>
<br>
rtems_task Init(rtems_task_argument )<br>
{<br>
printf (" --- Rtems++ V 1.1 --- \n\n");<br>
<br>
Tempo
t1("SELF",1,RTEMS_MINIMUM_STACK_SIZE,RTEMS_NO_PREEMPT,0,RTEMS_NO_FLOATING_POINT,RTEMS_LOCAL);<br>
<br>
printf("Tempo::initial status: %d
\n",t1.last_status_code());<br>
printf("Tempo::started: %d \n",t1.start(1));<br>
printf (" --- FIN --- \n\n");<br>
exit(0);<br>
}<br>
<br>
<br>
</div>
<div>Using grmon I can see the program exits normally.<br>
</div>
<div><br>
</div>
</div>
</div>
</div>
</blockquote></div></div>
Yep. exit(0) shuts down the entire program including all threads.
Nothing<br>
runs after exit(0) is called.<br>
<br>
Try rtems_task_delete( RTEMS_SELF ) which only deletes the executing
thread<br>
and does not shut down the application.<div><div><br></div></div></div></blockquote><div><br></div><div>That was the problem! Thank you guys. Feel a bit fool now!<br><br>cheers,<br></div><div>Pablo <br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><div><div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div>Pablo<br>
</div>
<div><br>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div> <br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div><br>
</div>
<div>cheers,<br>
Pablo<br>
</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Chris<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div> thank u,<br>
P<br>
<br>
<br>
<br>
Chris<br>
<br>
best regards,<br>
<br>
<br>
<br>
--<br>
Martínez, Pablo Agustín<br>
<br>
<br>
</div>
_________________________________________________<br>
users mailing list<br>
<a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a>
<mailto:<a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a>><br>
<a href="http://lists.rtems.org/__mailman/listinfo/users" target="_blank">http://lists.rtems.org/__mailman/listinfo/users</a><br>
<<a href="http://lists.rtems.org/mailman/listinfo/users" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a>><br>
<br>
_________________________________________________<br>
users mailing list<br>
<a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a>
<mailto:<a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a>><br>
<a href="http://lists.rtems.org/__mailman/listinfo/users" target="_blank">http://lists.rtems.org/__mailman/listinfo/users</a>
<div><br>
<<a href="http://lists.rtems.org/mailman/listinfo/users" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a>><br>
<br>
<br>
<br>
<br>
--<br>
Martínez, Pablo Agustín<br>
</div>
</blockquote>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Martínez, Pablo Agustín </div>
</div>
</blockquote>
<br>
</div>
<span><font color="#888888">
<pre cols="72">--
Joel Sherrill, Ph.D. Director of Research & Development
<a href="mailto:joel.sherrill@OARcorp.com" target="_blank">joel.sherrill@OARcorp.com</a> On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985</pre>
</font></span></div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Martínez, Pablo Agustín
</div>
</div>
</blockquote>
<br>
<pre cols="72">--
Joel Sherrill, Ph.D. Director of Research & Development
<a href="mailto:joel.sherrill@OARcorp.com" target="_blank">joel.sherrill@OARcorp.com</a> On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985</pre>
</div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Martínez, Pablo Agustín
</div></div>