public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Wolfram Kattanek <wolfram.kattanek@imms.de>
To: ecos-discuss@sourceware.cygnus.com
Subject: [ECOS] cyg_io_write & printf
Date: Wed, 07 Feb 2001 03:32:00 -0000	[thread overview]
Message-ID: <981545501.3a81321da0c3e@imp.imms.de> (raw)

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

             reply	other threads:[~2001-02-07  3:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-07  3:32 Wolfram Kattanek [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=981545501.3a81321da0c3e@imp.imms.de \
    --to=wolfram.kattanek@imms.de \
    --cc=ecos-discuss@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).