[ECOS] eCos 2.0 pthread_create problem
Andrew "ZACK" Zacharias
zack@mindspring.com
Thu Jun 12 19:28:00 GMT 2003
My ARM7 system crashes when I call pthread_create.
The assumptions: 'thread' declared as pthread_t thread;,
'vDiagDumpZack' has the form void* vDiagDumpZack(void*)
It is my belief that the following statement should create a thread,
initialize it to default values and run it.
rc = pthread_create(&thread, NULL, vDiagDumpZack, NULL);
The symption: The above statement crashes the system shortly after
reporting being properly created. I believe the crash happens when the
system tries to run it. (I think it has a stack size of zero and stack
location of 0, but I'm not positive.) The discussion list mentions
something about a possible stack alignment problem.
I'm running an ARM7 processor on a Cirrus Logic EDB-7212. My eCos library
is built with all packages.
void vDiagDumpRegisters(unsigned long ulR0, unsigned long ulR1, unsigned
long ulR2, unsigned long ulR3, unsigned long ulR4,
unsigned long ulR5, unsigned long ulR6, unsigned long ulR7)
{
diag_printf("\n\r %08lX, %08lX, %08lX, %08lX, %08lX, %08lX, %08lX,
%08lX", ulR0, ulR1, ulR2, ulR3, ulR4, ulR5, ulR6, ulR7);
}
void * vDiagDumpZack(void *z)
{
vDiagDumpRegisters(0x01234560, 0x12345671, 0x22345672, 0x32345673,
0x42345674, 0x52345675, 0x62345676, 0x72345677);
return 0;
}
void vThreadECI(cyg_addrword_t data)
{
int wCount, rc;
pthread_t thread;
wCount = 0;
diag_printf("\n\r vThreadECI");
while (1)
{
cyg_thread_delay(100);
diag_printf("*");
wCount++;
if (wCount == 5) // Wait for 5 '*'s to output before starting new thread
{
diag_printf("\n\r Creating pthread");
rc= pthread_create(&thread, NULL, vDiagDumpZack, NULL);
diag_printf("\n\r pthread result was %d", rc);
}
}
}
My output is:
vThreadECI
*****
Creating pthread
pthread result was 0
(silence, system is hosed)
--
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