[ECOS] uITRON implementation

Jonathan Larmour jlarmour@redhat.co.uk
Thu Aug 3 12:13:00 GMT 2000


Fabrice Gautier wrote:
> 
> > -----Original Message-----
> > From: Jonathan Larmour [ mailto:jlarmour@redhat.co.uk ]
> > Subject: Re: [ECOS] uITRON implementation
> >
> > It's an eCos "feature". I thought you maybe could get away
> > with changing
> > CYGDAT_UITRON_TASK_EXTERNS to use extern char *'s, but I
> > don't think that would work.
> 
> About this Macro, there is:
> 
> extern "C" void task1( unsigned int ); \
> extern "C" void task2( unsigned int ); \
> extern "C" void task3( unsigned int ); \
> extern "C" void task4( unsigned int ); \
> static char stack1[ CYGNUM_UITRON_STACK_SIZE ], \
> stack2[ CYGNUM_UITRON_STACK_SIZE ], \
> stack3[ CYGNUM_UITRON_STACK_SIZE ], \
> stack4[ CYGNUM_UITRON_STACK_SIZE ];
> 
> and in CYGDAT_UITRON_TASK_INITIALIZERS:
> 
> CYG_UIT_TASK( "t1", 1, task1, &stack1, CYGNUM_UITRON_STACK_SIZE ), \
> CYG_UIT_TASK( "t2", 2, task2, &stack2, CYGNUM_UITRON_STACK_SIZE ), \
> CYG_UIT_TASK( "t3", 3, task3, &stack3, CYGNUM_UITRON_STACK_SIZE ), \
> CYG_UIT_TASK( "t4", 4, task4, &stack4, CYGNUM_UITRON_STACK_SIZE ),
> 
> Does the 4 task described here are all the task in the system or only the
> task created at startup ?
>
> The first case seems improbable because that would mean the task not yet
> created should ne named task1() task2() ...
> 
> The second case seems improbable too because the staks fot the task not yet
> created are not allocated.

In the example above the 4 tasks are all the tasks in the system and are
created at startup. Tasks that are to be used with create/delete semantics
instead need to use the macro CYG_UIT_TASK_NOEXS, with the syntax e.g.:

CYG_UIT_TASK_NOEXS( "t5", &stack4, CYGNUM_UITRON_STACK_SIZE ),

i.e. you still specify the stack information. See the definition of cre_tsk
in <cyg/compat/uitron/uit_func.inl>.
 
> Or should I read:
> > extern "C" void task1( unsigned int ); \
> > extern "C" void task2( unsigned int ); \
> > extern "C" void task3( unsigned int ); \
> > extern "C" void task4( unsigned int ); \
> ==> Task created initially

Yes.

> static char stack1[ CYGNUM_UITRON_STACK_SIZE ], \
> stack2[ CYGNUM_UITRON_STACK_SIZE ], \
> stack3[ CYGNUM_UITRON_STACK_SIZE ], \
> stack4[ CYGNUM_UITRON_STACK_SIZE ];
> ==> Stack for all task in the system
> (in the configuration default task created at start=total task in system so
> ...)

Yes.

Perhaps you could change cre_tsk() to call malloc if p->get_stack_base() is
NULL, and then in the instantiations in your configuration, you pass NULL
for the stack size.

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault


More information about the Ecos-discuss mailing list