[ECOS] ecos context switch & stack usage question for Sparc platform

Grant Edwards grante@visi.com
Tue Apr 27 22:15:00 GMT 2004

> In ECOS I see the stack size grows from low memAddress
> to high memAddress.

Where do you see that?

> In ECOS twothread.c example
>  char stack[6000];
>  cyg_thread threadInfo;
>  cyg_thread_create(4, simple_program, (cyg_addrword_t)
> 0,"Thread A", (void *) stack, 4096,0, threadInfo);

Why allocate a stack of 6000 bytes and then only use 4096 of

If you look at the SPARC HAL code, I suspect it intializes SP
to ((unsigned)stackpointer) + stacksize.  Or possibly 4 less
than that.

> Since Sparc stack grows from high to low, should it be
> cyg_thread_create(4, simple_program, (cyg_addrword_t)
> 0,"Thread A", (void *) ((unsigned int)stack+6000),
> 4096,0, threadInfo);

No, I don't think so.

Grant Edwards

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

More information about the Ecos-discuss mailing list