[ECOS] idle thread stack alignment problem - again

Uwe Kindler uwe_kindler@web.de
Mon Dec 29 10:29:00 GMT 2003


shortly I posted about an alignment problem of the idle thread stack for the
Renesas EDOSK-2674 platform. I received the following solution for my

>The usual approach is to not worry about the lower limit of the stack,
>but to align the SP in HAL_THREAD_INIT_CONTEXT() when the thread is

I solved the problem by aligning the SP in HAL_THREAD_INIT_CONTEXT(). Now I
activated the configuration option:
CYGFUN_KERNEL_THREADS_STACK_CHECKING. That means the following code will be
executed every time a thread stack will be attached:

CYG_ASSERT( NULL != base, "stack base non-NULL" );
CYG_ASSERT( 0 == ((sizeof(CYG_WORD)-1) & (cyg_uint32)base), "stack base
alignment" );
CYG_ASSERT( 0 == ((sizeof(CYG_WORD)-1) & (cyg_uint32)top),  "stack  top
alignment" );

Because the idle thread stack(and maybe the thread stacks within the eCos
tests) are declared as unsigned char this assertion will fail because the
thread stacks are not aligned to a size of CYG_WORD but they are aligned
tounsigned char. So if I do not worry about stack alignment, the assertions
will fail.

Did i missed something or do I have to change soething when using
CYGFUN_KERNEL_THREADS_STACK_CHECKING. Could you please give me a hint what
to do in order to pass the assertions without changing the kernel and eCos
test code.

Thank you very much

Regards, Uwe

eCos port for Renesas EDOSK-2674

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

More information about the Ecos-discuss mailing list