This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: cyg_io_write & printf


Gary Thomas <gthomas@cambridge.redhat.com>:

> > More interestingly, if I change cyg_user_start to main then the output
> > becomes really weird:
> >
> > AEB-1 eCos
> > This isHaetest lessalo! eCos world!
> >
> > Both outputs seem to be mixed! The output changes a little bit if I use tty1
> > instead of ser1 or \r\n instead of \n but the mixing won't stop.
> >
> 
> This is happening because 'printf()' uses the diagnostic routines, which use
> polling
> The 'cyg_io_write()' uses interrupts to drive the port.  Thus, once the 'printf()'
> starts, all characters will be displayed at once.  The 'cyg_io_write()' relies on
> interrupts
> to drive the process.  Getting mixed output is certainly to be expected.
> 
> >
> > So here are my questions:
> >
> > - Why is the behavior so different when using main or cyg_user_start?
> 
> It depends on when interrupts get enabled.

But when do they get enabled when using main() or cyg_user_start() without
creating some user threads?

When I put the example code inside a user thread (created in cyg_user_start)
everything seems to work fine. Does that mean that (only) the scheduler enables
interrupts? Can the scheduler also be started from inside main() (via creating
a user thread)? When trying to do so I get the following assertion failure:

ASSERT FAIL: <2>intr.cxx   [571] static void Cyg_Interrupt::enable_interrupts()

Am I missing something fundamental about eCos?

> > - Is it possible to use both cyg_io_write and printf when only one physical
> >   serial port is available?
> 
> Yes, there is an option to get diagnostic output to basically go through 'cyg_io'

But this doesn't solve the above problems concerning mix of interrupt driven and
polled output or am I wrong about that?

> > - BTW: Is there a config option to turn off the output "AEB-1 eCos"?
> >
> 
> I'm pretty sure that this has been removed.  Are you using a "release" version
> or anonymous CVS?

I'm using an anonymous CVS snapshot from Jan 22 2001. However the "AEB-1 eCos"
string is coded inside the file packages/hal/arm/aeb/current/src/hal_diag.c
which is dated from Jul 4 2000.

Wolfram
--
Wolfram 'L.A.' Kattanek     Institut fuer Mikroelektronik- und
Email:       LA@imms.de     Mechatronik-Systeme (IMMS) gGmbH     
Tel: +49 3677 / 6783-55     Langewiesener Str. 22
Fax: +49 3677 / 6783-38     98693 Ilmenau / Germany

-------------------------------------------------
This mail sent through IMP: imp.imms.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]