Tue Mar 25 02:39:00 GMT 2003
Zi Zhou wrote:
> I am relatively new to eCos system. I have an IDT438 demo board and eCos
> 2.0 package. I built a eCos libarary ( net package) and I choose
> /dev/tty1 as console and included /dev/ser1 hardware device driver. I
> want to test the libarary with example code that come with eCos package,
> and I observed something I don't quite understand.
> I have a Hyperterminal connected to /dev/ser1, and I am able to see the
> expected display on Hyperterminal for program hello, serial,
> simple_alarm, however, program twothreads only print 'E' ( which is the
> first char of printf("Entering ... ") in twothreads.c). I compared the
> 4 source files. hello.c use main() as entry point while the rest use
> cyg_user_start(). Among the 3 programs that use cyg_user_start() as
> entry point, serial.c and simple_alarm.c do printf() in the threads
> while twothreads.c do printf() right after it enters cyg_user_start(), I
> vaguely remember some discussion about the restriction of when we can
> call printf() in eCos, but I can't find it now, Can some one kindly
> explain the reason behind the scenario I observed and give me some hint
> about how to fix the problem?
Your close to cause of the problem. Because twothreads starts with
cyg_user_start() rather than main(), when it does the printf *before* the
scheduler has started, interrupts are disabled. And because interrupts are
disabled, the serial driver can't work as its an interrupt driven driver!
The answer is: don't do that then :-). If your application (in this case
the example application twothreads) uses interrupts because you changed
the configuration to use an interrupt-driven driver, then the result isn't
> Another question is which driver is used for stdio printf()? I choose
> /dev/tty1 as console which use /dev/ser1 hardware device driver, does
> this mean in this case printf() will use /dev/ser1 driver?
Yes, although there are configuration options you could use to override
that if you wanted, but probably best leave it as is.
eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine
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