public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] cyg_io_write & printf
@ 2001-02-07  3:32 Wolfram Kattanek
  2001-02-07  6:38 ` Gary Thomas
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Kattanek @ 2001-02-07  3:32 UTC (permalink / raw)
  To: ecos-discuss

Hello,

I'm playing a little bit with the serial driver functions and came across some
weird phenomena. Can anyone shed some light on the following questions?

My platform is ARM AEB-1 revision C with one serial port. I'm working with CVS
sources on a linux host. I configured eCos in the following way: default aeb
template; enabled CYGDBG_HAL_DIAG_DISABLE_GDB_PROTOCOL, CYGPKG_IO_SERIAL_DEVICES
and CYGPKG_IO_SERIAL_TTY_TTY1; changed CYGHWR_HAL_ARM_AEB_REVISION to "C".

My test program is:

#include <cyg/io/io.h> 
#include <cyg/io/serialio.h> 
#include <cyg/error/codes.h> 
#include <stdio.h> 

void cyg_user_start(void) 
{ 
  cyg_uint32 length; 
  Cyg_ErrNo error; 
  char test_msg1[]="This is a test message!\n";
  cyg_io_handle_t serial_port_handle;

  error = cyg_io_lookup("/dev/ser1", &serial_port_handle);
  if (error == ENOERR) {
    length = strlen(&test_msg1[0]); 
    cyg_io_write(serial_port_handle, &test_msg1[0], &length);
  }
  printf("Hello eCos world!\n");
} 

I compiled and linked it in the usual (eCos) way and downloaded it to
the AEB board using a terminal program (minicom; comm parameters:
38400 8N1 no Hardware Flow Control and no Software Flow Control).
Then I started the downloaded program using the AEB monitor program
and watched the output inside minicom.

In the above configuration of the example program I got the following
output:

ARM Evaluation Board Boot Monitor 0.01 (19 APR 1998)
Press ENTER within 2 seconds to stop autoboot
Boot: download c000
Ready to download. Use 'transmit' option on terminal emulator to download file.
Loaded file simple_io_sample.ram.bin at address 0000c000, size = 48028
Boot: go

AEB-1 eCos
Hello eCos world!
This is a test message!


The interesting thing about that output is that the cyg_io_write and printf
statements seem to output their messages in the "wrong" order!?

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.

So here are my questions:

- Why is the behavior so different when using main or cyg_user_start?
- Is it possible to use both cyg_io_write and printf when only one physical
  serial port is available?
- Why the statement order does not reflect the output order in the given
  example?
- BTW: Is there a config option to turn off the output "AEB-1 eCos"?

Any comments are appreciated!

Thanks,
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-02-08  3:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-07  3:32 [ECOS] cyg_io_write & printf Wolfram Kattanek
2001-02-07  6:38 ` Gary Thomas
2001-02-07  7:14   ` Wolfram Kattanek
2001-02-07  8:42     ` Jonathan Larmour
2001-02-08  3:03       ` Wolfram Kattanek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).