This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
strange serial (or scheduler?) problem.
- To: ecos-discuss at sources dot redhat dot com
- Subject: [ECOS] strange serial (or scheduler?) problem.
- From: Andreas Bürgel <ab at genologic dot de>
- Date: Wed, 20 Jun 2001 18:25:52 +0200
- Organization: GenoLogic GmbH, Dortmund
Hi folks,
I set CYGSEM_LIBC_STARTUP_MAIN_INITCONTEXT = 1 in my ecos.ecc, so "main"
doesn't run in an own thread anymore.
I'm using following simple serial program:
void cyg_user_start ( void) {
Cyg_Thread* lThread1;
Cyg_Thread* lThread2;
cyg_int32 lError;
char* lPong = "pong";
lThread2 = new Cyg_Thread ( CYG_SCHED_DEFAULT_INFO + 30,
dumbWork,
(cyg_addrword_t) lPong,
"DumbWork",
(cyg_addrword_t) gStack2,
4096);
printf ( "thread2 created ...\n");
lThread1 = new Cyg_Thread ( CYG_SCHED_DEFAULT_INFO,
serialReader,
(cyg_addrword_t) lPong,
"SerialReader",
(cyg_addrword_t) gStack1,
4096);
printf ( "thread1 created ...\n");
[ ... setup serial ... ]
lThread1->resume ();
printf ( "thread1 resumed ...\n");
/*
lThread2->resume ();
printf ( "thread2 resumed ...\n");
*/
}
void serialReader ( cyg_addrword_t aDataAddress) {
char lBuffer;
cyg_uint32 lLength = 1;
unsigned int lCounter = 0;
printf ( "before reading data\n");
for ( ;;) {
cyg_io_read ( gTTYDevHandle,
&lBuffer,
&lLength);
lFlag = 1 - lFlag;
printf ( "read message %d \"%c\"\n", lCounter, lBuffer);
lCounter++;
}
}
void dumbWork ( cyg_addrword_t aDataAddress) {
for ( ;;) {
//blinkLED ();
}
}
I running "serialReader" as single thread connected to a minicom
terminal program. Everything's working fine until I send characters to
the device. If I don't send characters to the device for a few seconds,
the device crashes and gdb looses the connection. I don't know if it
crashes in the meantime or while receiving the first character after the
break.
If I let the "dumbWork" thread run while this test, everything works
stable.
Any ideas for this?
Thanks in advance.
-----------------------------------------------------
i.A. Andreas Bürgel GenoLogic GmbH
Software Engineer Joseph-von-Fraunhofer-Str. 13
D-44227 DORTMUND
Germany
ab@genologic.de phone +49 (0) 231/477349-0
fax +49 (0) 231/4761234