problem starting a rtems task

Joel Sherrill joel.sherrill at oarcorp.com
Thu Jun 26 21:54:03 UTC 2014


On 6/26/2014 4:48 PM, Martínez, Pablo wrote:
>
>
>
> On 26 June 2014 18:28, Chris Johns <chrisj at rtems.org
> <mailto:chrisj at rtems.org>> wrote:
>
>     On 26/06/2014 11:54 pm, Martínez, Pablo wrote:
>
>
>
>
>         On 26 June 2014 08:37, Chris Johns <chrisj at rtems.org
>         <mailto:chrisj at rtems.org>
>         <mailto:chrisj at rtems.org <mailto:chrisj at rtems.org>>> wrote:
>
>
>
>             On 26/06/2014 12:56 am, Martínez, Pablo wrote:
>
>                 Hi,
>
>                 Im having troubles trying to use the class rtemsTask
>         from the the
>                 librtems++.
>
>                 (
>                
>         https://github.com/atgreen/__RTEMS/blob/master/c/src/__librtems%2B%2B/include/rtems%__2B%2B/rtemsTask.h
>
>
>                
>         <https://github.com/atgreen/RTEMS/blob/master/c/src/librtems%2B%2B/include/rtems%2B%2B/rtemsTask.h>
>                 )
>
>                 This class is basically a wrapper for the rtems task api.
>
>                 I can create the task successfully (its returns 0),
>         but when I call
>                 start() the entry point origin doesnt start despite
>         returning 0
>                 (this
>                 method just write a memory position to check if the
>         task is
>                 working).
>
>
>                 const rtems_status_code rtemsTask::start(const
>                 rtems_task_argument arg)
>
>
>                 {
>                 if (owner)
>
>
>                 {
>                 argument = arg;
>
>
>                 // pass the this pointer as the argument
>                 set_status_code(rtems_task___start(id,
>                 origin,
>                 (rtems_task_argument) this));
>
>
>                 }
>                 else
>                 set_status_code(RTEMS_NOT___OWNER_OF_RESOURCE);
>
>                 return last_status_code();
>
>
>                 }
>
>                 Any help?
>
>
>             Are the priorities ok ? If not it might not be able to run.
>
>
>         Im using this parameters to create the task:
>
>         "SELF"
>         1  (priority)
>         RTEMS_MINIMUM_STACK_SIZE
>         RTEMS_NO_PREEMPT
>         0
>         RTEMS_NO_FLOATING_POINT
>         RTEMS_LOCAL
>
>
>         In C implementation is working fine, but the problem comes
>         with C++.
>
>
>     I would need a more complete example to know what is happening.
>
>
> Chris,
>
> Im trying to use the rtems++ library as follows:
>
>
> //////////////Tempo.h
>
> #ifndef TEMPO_H_
> #define TEMPO_H_
>
> #include <rtems++/rtemsTask.h>
> #include <rtems++/rtemsTaskMode.h>
>
> class Tempo: public rtemsTask
> {
> public:
>     Tempo(const char* name,
>             const rtems_task_priority initial_priority,
>             const uint32_t stack_size,
>             const rtems_mode preemption = RTEMS_NO_PREEMPT,
>             const rtems_mode timeslice = RTEMS_NO_TIMESLICE,
>             const rtems_mode asr = RTEMS_NO_ASR,
>             const rtems_interrupt_level interrupt_level = 0,
>             const FloatingPoint floating_point = fpoff,
>             const Scope scope = local);
>
>     virtual ~Tempo();
>     //rtems_task origin(rtems_task_argument argument);
>
>     const rtems_status_code start(const rtems_task_argument argument);
>     static rtems_task origen(rtems_task_argument argument);
>     void cuerpo(rtems_task_argument argument);
>
> private:
>
>       // task name
>       rtems_name name;
>       char name_str[5];
>
>       // owner, true if this object owns the task
>       // will delete the task when it destructs
>       bool owner;
>
>       // the rtems id, object handle
>       rtems_id id;
>
>       // the argument for the task, this class uses the actual argument
>       // passed to RTEMS
>       rtems_task_argument argument;
>
> };
>
> #endif /* TEMPO_H_ */
>
>
> //////////////Tempo.cpp
>
> #include "Tempo.h"
>
> Tempo::Tempo(const char* tname,
>                      const rtems_task_priority initial_priority,
>                      const uint32_t stack_size,
>                      const rtems_mode preemption,
>                      const rtems_mode timeslice,
>                      const rtems_mode asr,
>                      const rtems_interrupt_level interrupt_level,
>                      const FloatingPoint floating_point,
>                      const Scope scope)
>   : name(rtems_build_name('S', 'E', 'L', 'F')),
>     owner(true),
>     id(RTEMS_SELF),
>     argument(0)
> {
>   strcpy(name_str, "SELF");
>   create(tname,
>          initial_priority,
>          stack_size,
>          preemption,
>          timeslice,
>          asr,
>          interrupt_level,
>          floating_point,
>          scope);
> }
>
>
> Tempo::~Tempo()
> {
> }
>
>
> const rtems_status_code Tempo::start(const rtems_task_argument arg)
> {
>
>     argument = arg;
>     // pass the this pointer as the argument
>     set_status_code(rtems_task_start(id,origen,(rtems_task_argument)
> this));
>
>     printf ("   ---Tempo::start  --- \n\n");
>
>   return last_status_code();
> }
>
>
> rtems_task Tempo::origen(rtems_task_argument argument)
> {
>     //just for debugging:
>     unsigned *regout;
>     regout= (unsigned*)0x80000d04;
>     (*regout)=0x12345678;
>
>     printf ("   --- Tempo::origen  --- \n\n");
>
>   Tempo *task = (Tempo*) argument;
>   task->cuerpo(task->argument);
>
> }
>
> void Tempo::cuerpo(rtems_task_argument )
> {
>     printf ("   --- Tempo::do sth  --- \n\n");
> }
>
>
> ::::::::::
>
> "  ---Tempo::start  --- \n\n" gets printed, but origen() is not triggered.
>
>
> Trying to solve this out, Im trying with one solution I just found
> (from you!)
> You use a thread template. I just found it so I haven't tested it yet.
>
> http://comments.gmane.org/gmane.os.rtems.user/20625
>

This is still not complete. There has to be an initialization task and
some RTEMS configuration (e.g. CONFIGURE_xxx followed by
an include of <rtems/confdefs.h>).

My first guess is that you have an Init task at priority 1 sitting
in a loop watching for something to happen. It won't happen
because it never yields the processor. 

An alternative is that the Init() task falls off the bottom of its
body and this is a fatal error halting the system.

If we saw the Init() and configuration that goes with this
it would really help. Something invokes your Tempo
constructor.

--joel

>
> cheers,
> Pablo
>
>  
>
>     Chris
>
>         thank u,
>         P
>
>
>
>             Chris
>
>                 best regards,
>
>
>
>                 --
>                 Martínez, Pablo Agustín
>
>
>                 _________________________________________________
>                 users mailing list
>                 users at rtems.org <mailto:users at rtems.org>
>         <mailto:users at rtems.org <mailto:users at rtems.org>>
>                 http://lists.rtems.org/__mailman/listinfo/users
>                 <http://lists.rtems.org/mailman/listinfo/users>
>
>             _________________________________________________
>             users mailing list
>             users at rtems.org <mailto:users at rtems.org>
>         <mailto:users at rtems.org <mailto:users at rtems.org>>
>             http://lists.rtems.org/__mailman/listinfo/users
>
>             <http://lists.rtems.org/mailman/listinfo/users>
>
>
>
>
>         --
>         Martínez, Pablo Agustín
>
>
>
>
> -- 
> Martínez, Pablo Agustín

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20140626/b9383cc7/attachment-0001.html>


More information about the users mailing list