This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
cyg_io_write & printf
- To: ecos-discuss at sourceware dot cygnus dot com
- Subject: [ECOS] cyg_io_write & printf
- From: Wolfram Kattanek <wolfram dot kattanek at imms dot de>
- Date: Wed, 07 Feb 2001 12:31:41 +0100 (MET)
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