public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Create a thread (uitron)
@ 2007-04-30 14:36 LONY David
  2007-04-30 14:47 ` Gary Thomas
  2007-05-02 13:15 ` LONY David
  0 siblings, 2 replies; 5+ messages in thread
From: LONY David @ 2007-04-30 14:36 UTC (permalink / raw)
  To: ecos-discuss

Hi all,

I'm trying to create a thread in eCos (uitron interface) but it does not 
work. I'm new to eCos and uITRON, so I take a exemple and I'm try to 
customize it...
Here it my program :

#include <cyg/compat/uitron/uit_func.h>
#include <stdio.h>

void task2(unsigned int a)
{
 
  printf("In function test()\n");
 
}


int main()
{

  ID tid = 2;
  T_CTSK thread_attr;
  int retval;

  printf("In main\n");
 
  thread_attr.stksz = CYGNUM_UITRON_STACK_SIZE;
  thread_attr.task = (FP)&task2;
 
  retval = cre_tsk(tid, &thread_attr);
 
  if(retval != E_OK)
    {
      printf("Error %d !!!\n",retval);
    }
  else
    {
      printf(" Good! \n");
    }
 
  return 0;
 
}


When I'm trying to debug it, I always obtain an error. Someone can help me?
PS : Number of task is set to 4 and the number of task which start is 
set to 1.
I also modify the option Static Initializers to CYG_UIT_TASK_NOEXS for 
task 2,3 and 4

Thank you
Best regards.

David


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] Create a thread (uitron)
  2007-04-30 14:36 [ECOS] Create a thread (uitron) LONY David
@ 2007-04-30 14:47 ` Gary Thomas
  2007-05-01 20:53   ` Daniel Morris
  2007-05-02 13:15 ` LONY David
  1 sibling, 1 reply; 5+ messages in thread
From: Gary Thomas @ 2007-04-30 14:47 UTC (permalink / raw)
  To: LONY David; +Cc: ecos-discuss

LONY David wrote:
> Hi all,
> 
> I'm trying to create a thread in eCos (uitron interface) but it does not 
> work. I'm new to eCos and uITRON, so I take a exemple and I'm try to 
> customize it...
> Here it my program :
> 
> #include <cyg/compat/uitron/uit_func.h>
> #include <stdio.h>
> 
> void task2(unsigned int a)
> {
> 
>  printf("In function test()\n");
> 
> }
> 
> 
> int main()
> {
> 
>  ID tid = 2;
>  T_CTSK thread_attr;
>  int retval;
> 
>  printf("In main\n");
> 
>  thread_attr.stksz = CYGNUM_UITRON_STACK_SIZE;
>  thread_attr.task = (FP)&task2;
> 
>  retval = cre_tsk(tid, &thread_attr);
> 
>  if(retval != E_OK)
>    {
>      printf("Error %d !!!\n",retval);
>    }
>  else
>    {
>      printf(" Good! \n");
>    }
> 
>  return 0;
> 
> }
> 
> 
> When I'm trying to debug it, I always obtain an error. Someone can help me?
> PS : Number of task is set to 4 and the number of task which start is 
> set to 1.
> I also modify the option Static Initializers to CYG_UIT_TASK_NOEXS for 
> task 2,3 and 4

Do you have some compelling reason to use uItron?  There are few,
if any, eCos maintainers that know much about this anymore.

I'd suggest that you look at a more modern (and certainly
more supported) API such as POSIX.

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] Create a thread (uitron)
  2007-04-30 14:47 ` Gary Thomas
@ 2007-05-01 20:53   ` Daniel Morris
  2007-05-02  9:16     ` David LONY
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Morris @ 2007-05-01 20:53 UTC (permalink / raw)
  To: Gary Thomas; +Cc: LONY David, ecos-discuss

On Mon, Apr 30, 2007 at 08:47:09AM -0600, Gary Thomas wrote:
> LONY David wrote:
> >Hi all,
> >
> >I'm trying to create a thread in eCos (uitron interface) but it does not 
> >work. I'm new to eCos and uITRON, so I take a exemple and I'm try to 
> >customize it...
> >Here it my program :
> >
> >#include <cyg/compat/uitron/uit_func.h>
> >#include <stdio.h>
> >
> >void task2(unsigned int a)
> >{
> >
> > printf("In function test()\n");
> >
> >}
> >
> >
> >int main()
> >{
> >
> > ID tid = 2;
> > T_CTSK thread_attr;
> > int retval;
> >
> > printf("In main\n");
> >
> > thread_attr.stksz = CYGNUM_UITRON_STACK_SIZE;
> > thread_attr.task = (FP)&task2;
> >
> > retval = cre_tsk(tid, &thread_attr);
> >
> > if(retval != E_OK)
> >   {
> >     printf("Error %d !!!\n",retval);
> >   }
> > else
> >   {
> >     printf(" Good! \n");
> >   }
> >
> > return 0;
> >
> >}
> >
> >
> >When I'm trying to debug it, I always obtain an error. Someone can help me?
> >PS : Number of task is set to 4 and the number of task which start is 
> >set to 1.
> >I also modify the option Static Initializers to CYG_UIT_TASK_NOEXS for 
> >task 2,3 and 4
> 
> Do you have some compelling reason to use uItron?  There are few,
> if any, eCos maintainers that know much about this anymore.

Awe, c'mon Gary, don't be so pessimistic ;-) eCos maintainers working at
eCosCentric have good knowledge of uITRON, we offer commercial support
to customers for existing uITRON profiles, as well as consultancy &
development around some of the newer profiles that have been published
since the original uITRON port. 

> 
> I'd suggest that you look at a more modern (and certainly
> more supported) API such as POSIX.

Well the great thing about standards is there are so many to choose
from...  There certainly doesn't seem to be as much interest in uITRON
these days, but perhaps that's just because ecos-discuss's window to the
web is focused in English, rather than Japanese?? It would be
interesting to hear of other users (& applications) that have recent
experience of using uITRON with eCos from the community.

 Daniel

%<----------------------------------------------------------------------
  Daniel Morris - Sales & Marketing Director
  eCosCentric - The eCos and RedBoot experts
  Tel: +44 1223 245 571 - info@eCosCentric.com
  DDI: +44 1269 591 171 - danielm@eCosCentric.com



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] Create a thread (uitron)
  2007-05-01 20:53   ` Daniel Morris
@ 2007-05-02  9:16     ` David LONY
  0 siblings, 0 replies; 5+ messages in thread
From: David LONY @ 2007-05-02  9:16 UTC (permalink / raw)
  To: Daniel Morris, ecos-discuss

Hi all,

I change my program to :

#include <stdio.h>
#include <cyg/compat/uitron/uit_func.h>

void* task4(unsigned int a)
{

printf("Hello\n");

}

main()
{

  ER status;
  ID tid=4;
  T_CTSK pk_ctsk;


  pk_ctsk.exinf=NULL;
  pk_ctsk.tskatr=TA_HLNG; /* task attributes */
  pk_ctsk.task=(FP)task4;/* task start address */
  pk_ctsk.itskpri=4;   /* initial task priority */
  pk_ctsk.stksz=CYGNUM_UITRON_STACK_SIZE;     /* stack size */
 
  status = cre_tsk( tid, &pk_ctsk );
  if(status != E_OK)
    printf("Problem when create the task\n");

}

But, I cannot create a thread in eCos with uITRON API. However, I set 
the option "Number of tasks created initially" to 3 (default 4) and 
"Static Initializers" to :
CYG_UIT_TASK( "t1", 1, task1, &stack1, MAX(CYGNUM_UITRON_STACK_SIZE, 
CYGNUM_HAL_STACK_SIZE_MINIMUM) ), \
CYG_UIT_TASK( "t2", 2, task2, &stack2, MAX(CYGNUM_UITRON_STACK_SIZE, 
CYGNUM_HAL_STACK_SIZE_MINIMUM) ), \
CYG_UIT_TASK( "t3", 3, task3, &stack3, MAX(CYGNUM_UITRON_STACK_SIZE, 
CYGNUM_HAL_STACK_SIZE_MINIMUM) ), \
CYG_UIT_TASK_NOEXS( "t4", &stack4, MAX(CYGNUM_UITRON_STACK_SIZE, 
CYGNUM_HAL_STACK_SIZE_MINIMUM) ),

default is :

CYG_UIT_TASK( "t1", 1, task1, &stack1, MAX(CYGNUM_UITRON_STACK_SIZE, 
CYGNUM_HAL_STACK_SIZE_MINIMUM) ), \
CYG_UIT_TASK( "t2", 2, task2, &stack2, MAX(CYGNUM_UITRON_STACK_SIZE, 
CYGNUM_HAL_STACK_SIZE_MINIMUM) ), \
CYG_UIT_TASK( "t3", 3, task3, &stack3, MAX(CYGNUM_UITRON_STACK_SIZE, 
CYGNUM_HAL_STACK_SIZE_MINIMUM) ), \
CYG_UIT_TASK( "t4", 4, task4, &stack4, MAX(CYGNUM_UITRON_STACK_SIZE, 
CYGNUM_HAL_STACK_SIZE_MINIMUM) ),

Does I forget something ? Could someone help me?
I'm new to eCos and uITRON. Everything seems to be ok but it does not 
work.... :(

Thanks a lot.
David

Daniel Morris a écrit :
> On Mon, Apr 30, 2007 at 08:47:09AM -0600, Gary Thomas wrote:
>   
>> LONY David wrote:
>>     
>>> Hi all,
>>>
>>> I'm trying to create a thread in eCos (uitron interface) but it does not 
>>> work. I'm new to eCos and uITRON, so I take a exemple and I'm try to 
>>> customize it...
>>> Here it my program :
>>>
>>> #include <cyg/compat/uitron/uit_func.h>
>>> #include <stdio.h>
>>>
>>> void task2(unsigned int a)
>>> {
>>>
>>> printf("In function test()\n");
>>>
>>> }
>>>
>>>
>>> int main()
>>> {
>>>
>>> ID tid = 2;
>>> T_CTSK thread_attr;
>>> int retval;
>>>
>>> printf("In main\n");
>>>
>>> thread_attr.stksz = CYGNUM_UITRON_STACK_SIZE;
>>> thread_attr.task = (FP)&task2;
>>>
>>> retval = cre_tsk(tid, &thread_attr);
>>>
>>> if(retval != E_OK)
>>>   {
>>>     printf("Error %d !!!\n",retval);
>>>   }
>>> else
>>>   {
>>>     printf(" Good! \n");
>>>   }
>>>
>>> return 0;
>>>
>>> }
>>>
>>>
>>> When I'm trying to debug it, I always obtain an error. Someone can help me?
>>> PS : Number of task is set to 4 and the number of task which start is 
>>> set to 1.
>>> I also modify the option Static Initializers to CYG_UIT_TASK_NOEXS for 
>>> task 2,3 and 4
>>>       
>> Do you have some compelling reason to use uItron?  There are few,
>> if any, eCos maintainers that know much about this anymore.
>>     
>
> Awe, c'mon Gary, don't be so pessimistic ;-) eCos maintainers working at
> eCosCentric have good knowledge of uITRON, we offer commercial support
> to customers for existing uITRON profiles, as well as consultancy &
> development around some of the newer profiles that have been published
> since the original uITRON port. 
>
>   
>> I'd suggest that you look at a more modern (and certainly
>> more supported) API such as POSIX.
>>     
>
> Well the great thing about standards is there are so many to choose
> from...  There certainly doesn't seem to be as much interest in uITRON
> these days, but perhaps that's just because ecos-discuss's window to the
> web is focused in English, rather than Japanese?? It would be
> interesting to hear of other users (& applications) that have recent
> experience of using uITRON with eCos from the community.
>
>  Daniel
>
> %<----------------------------------------------------------------------
>   Daniel Morris - Sales & Marketing Director
>   eCosCentric - The eCos and RedBoot experts
>   Tel: +44 1223 245 571 - info@eCosCentric.com
>   DDI: +44 1269 591 171 - danielm@eCosCentric.com
>
>
>
>
>   



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] Create a thread (uitron)
  2007-04-30 14:36 [ECOS] Create a thread (uitron) LONY David
  2007-04-30 14:47 ` Gary Thomas
@ 2007-05-02 13:15 ` LONY David
  1 sibling, 0 replies; 5+ messages in thread
From: LONY David @ 2007-05-02 13:15 UTC (permalink / raw)
  To: ecos-discuss

Hi all,

I succeded to create a uITRON thread!!!
My options :

"Number of tasks" --> 4
"Start tasks" -> 1
...
...
"Externs for initialization" ->
extern "C" void RTDS_Start( unsigned int ); \
extern "C" void task2( unsigned int ); \
extern "C" void task3( unsigned int ); \
extern "C" void task4( unsigned int ); \
static char stack1[ MAX(CYGNUM_UITRON_STACK_SIZE, 
CYGNUM_HAL_STACK_SIZE_MINIMUM) ], \
stack2[ MAX(CYGNUM_UITRON_STACK_SIZE, CYGNUM_HAL_STACK_SIZE_MINIMUM) ], \
stack3[ MAX(CYGNUM_UITRON_STACK_SIZE, CYGNUM_HAL_STACK_SIZE_MINIMUM) ], \
stack4[ MAX(CYGNUM_UITRON_STACK_SIZE, CYGNUM_HAL_STACK_SIZE_MINIMUM) ];

"Static initializers" ->
CYG_UIT_TASK( "t1", 1, RTDS_Start, &stack1, 
MAX(CYGNUM_UITRON_STACK_SIZE, CYGNUM_HAL_STACK_SIZE_MINIMUM) ), \
CYG_UIT_TASK_NOEXS("t2", &stack2, MAX(CYGNUM_UITRON_STACK_SIZE, 
CYGNUM_HAL_STACK_SIZE_MINIMUM) ), \
CYG_UIT_TASK_NOEXS("t3", &stack3, MAX(CYGNUM_UITRON_STACK_SIZE, 
CYGNUM_HAL_STACK_SIZE_MINIMUM) ), \
CYG_UIT_TASK_NOEXS("t4", &stack4, MAX(CYGNUM_UITRON_STACK_SIZE, 
CYGNUM_HAL_STACK_SIZE_MINIMUM) ),

So with these parameters I can use 3 ID (2,3 and 4) to create a miximum 
of 3 threads
Then to start the RTDS_Start thread I just have to call the 
cyg_uitron_start() function (see the main function below)....
But I cannot understand the behavior of my test program... I try to 
create another task in the main (it work well!!!) but if I do it on 
RTDS_Start it does not work!!!

This is my program :

#include <cyg/compat/uitron/uit_func.h>
#include <stdio.h>

void task2(unsigned int a)
{
  printf("In function test()\n");
}

void task1(unsigned int b)
{
 
  printf("Hello from task1\n");
}

void RTDS_Start()
{
  ID tid = 2;
  T_CTSK thread_attr;
  int retval;
 
  printf("Hello from RTDS_Start\n");
 
  thread_attr.stksz = 1000;
  thread_attr.itskpri = 5;
  thread_attr.task = (FP)&task2;
  retval = cre_tsk(tid, &thread_attr);
 
  if(retval != E_OK)
    {
      printf("Error in RTDS_Start %d !!!\n",retval);
    }
  else
    {
      printf("Good in RTDS_Start! \n");
      sta_tsk(tid,NULL);
    } 
}


int main()
{
  ID tid = 3;
  T_CTSK thread_attr;
  int retval;
 
  printf("In main\n");
  cyg_uitron_start();
 
  thread_attr.stksz = 1000;
  thread_attr.itskpri = 5;
  thread_attr.task = (FP)&task1;
  retval = cre_tsk(tid, &thread_attr);
 
  if(retval != E_OK)
    {
      printf("Error in main %d !!!\n",retval);
    }
  else
    {
      printf("Good in main! \n");
      sta_tsk(tid,NULL);
    }
  return 0;
}

Some ideas ?
PS : Does someone know the function of the 2nd argument in 
|*sta_tsk*|(ID tskid, INT stacd) function ?

Thanks a lot.
David


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-05-02 13:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-30 14:36 [ECOS] Create a thread (uitron) LONY David
2007-04-30 14:47 ` Gary Thomas
2007-05-01 20:53   ` Daniel Morris
2007-05-02  9:16     ` David LONY
2007-05-02 13:15 ` LONY David

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).