public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] LIBC and STDIO
@ 1999-12-16 16:35 Perry Wang
  1999-12-17  0:30 ` Jesper Skov
  0 siblings, 1 reply; 7+ messages in thread
From: Perry Wang @ 1999-12-16 16:35 UTC (permalink / raw)
  To: ecos-discuss

Hello.

printf() works fine under arm-elf-gdb because it uses /dev/haldiag

However, if I change

CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE

to "/dev/tty1" instead of "/dev/haldiag"

My program hangs at the printf()

These are all done before I start the threads so the mutex stuff shouldn't
matter I believe.

Any help greatly appreciated.

perry

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

* Re: [ECOS] LIBC and STDIO
  1999-12-16 16:35 [ECOS] LIBC and STDIO Perry Wang
@ 1999-12-17  0:30 ` Jesper Skov
  1999-12-17 11:04   ` Perry Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Jesper Skov @ 1999-12-17  0:30 UTC (permalink / raw)
  To: Perry Wang; +Cc: ecos-discuss

>>>>> "Perry" == Perry Wang <perrywang@nmnc.com> writes:

Perry> CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE

Perry> to "/dev/tty1" instead of "/dev/haldiag"

Perry> My program hangs at the printf()

Did you enable that serial driver? Make sure you include the IO_SERIAL
package and enable the PID driver (see pkgconf/io_serial.h in your
build tree).

Jesper

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

* RE: [ECOS] LIBC and STDIO
  1999-12-17  0:30 ` Jesper Skov
@ 1999-12-17 11:04   ` Perry Wang
  1999-12-17 12:23     ` Jonathan Larmour
  1999-12-21 14:51     ` [ECOS] tty driver Perry Wang
  0 siblings, 2 replies; 7+ messages in thread
From: Perry Wang @ 1999-12-17 11:04 UTC (permalink / raw)
  To: jskov; +Cc: ecos-discuss

Thanks for replying.  Sorry I forgot to mention that I'm using AEB-1 rev. C


I do have the serial package enabled.. some of the defines are here:

#define CYGPKG_IO_SERIAL_TTY

#define CYGPKG_IO_SERIAL_TTY_TTYDIAG
#undef  CYGPKG_IO_SERIAL_TTY_TTY0
#define CYGDAT_IO_SERIAL_TTY_TTY0_DEV "/dev/ser0"
#define CYGPKG_IO_SERIAL_TTY_TTY1
#define CYGDAT_IO_SERIAL_TTY_TTY1_DEV "/dev/ser1"
#undef  CYGPKG_IO_SERIAL_TTY_TTY2
#define CYGDAT_IO_SERIAL_TTY_TTY2_DEV "/dev/ser2"

#define  CYGPKG_IO_SERIAL_ARM_AEB
#define  CYGPKG_IO_SERIAL_ARM_AEB_SERIAL0
#define CYGDAT_IO_SERIAL_ARM_AEB_SERIAL0_NAME "/dev/ser0"
#define CYGNUM_IO_SERIAL_ARM_AEB_SERIAL0_BAUD 38400
#define CYGNUM_IO_SERIAL_ARM_AEB_SERIAL0_BUFSIZE 128
#define  CYGPKG_IO_SERIAL_ARM_AEB_SERIAL1
#define CYGDAT_IO_SERIAL_ARM_AEB_SERIAL1_NAME "/dev/ser1"
#define CYGNUM_IO_SERIAL_ARM_AEB_SERIAL1_BAUD 38400
#define CYGNUM_IO_SERIAL_ARM_AEB_SERIAL1_BUFSIZE 128

io write to /dev/tty1 or /dev/ser1 directly works fine.  However the libc
printf doesn't like it.  I guess I'm still missing something.  Changing
CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE back to "/dev/haldiag" will work, but it
prints out some garbage only GDB will understand.

thanks again



> -----Original Message-----
> From: jskov@cygnus.co.uk [ mailto:jskov@cygnus.co.uk ]
> Sent: Friday, December 17, 1999 12:17 AM
> To: Perry Wang
> Cc: ecos-discuss@sourceware.cygnus.com
> Subject: Re: [ECOS] LIBC and STDIO
>
>
> >>>>> "Perry" == Perry Wang <perrywang@nmnc.com> writes:
>
> Perry> CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE
>
> Perry> to "/dev/tty1" instead of "/dev/haldiag"
>
> Perry> My program hangs at the printf()
>
> Did you enable that serial driver? Make sure you include the IO_SERIAL
> package and enable the PID driver (see pkgconf/io_serial.h in your
> build tree).
>
> Jesper

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

* Re: [ECOS] LIBC and STDIO
  1999-12-17 11:04   ` Perry Wang
@ 1999-12-17 12:23     ` Jonathan Larmour
  1999-12-17 16:05       ` Perry Wang
  1999-12-21 14:51     ` [ECOS] tty driver Perry Wang
  1 sibling, 1 reply; 7+ messages in thread
From: Jonathan Larmour @ 1999-12-17 12:23 UTC (permalink / raw)
  To: Perry Wang; +Cc: jskov, ecos-discuss

Perry Wang wrote:
> 
> I do have the serial package enabled.. some of the defines are here:
> 
[snip]
> io write to /dev/tty1 or /dev/ser1 directly works fine.  However the libc
> printf doesn't like it.  I guess I'm still missing something.  Changing
> CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE back to "/dev/haldiag" will work, but it
> prints out some garbage only GDB will understand.

I suppose it isn't very helpful for me to say that I just tried it here on
an AEB-1B and (from what I could tell[1]) I could run the libc stdiooutput
test fine.

Have you tried the other serial line? It could be some conflict between the
hal diag initialization and the serial driver initialization - we've had
such things happen before. If that doesn't work either, it at least gives
you the chance to debug it (using GDB attached to the first serial line) to
see what is going on.

[1] For reasons to long to explain, I connected with GDB over a TCP
connection to a proxy test server, and used an ethernet packet sniffer since
GDB silently discards anything not in remote protocol packets. Yes, I'm
lazy.

Jifl
-- 
Cygnus Solutions, 35 Cambridge Place, Cambridge, UK.  Tel: +44 (1223) 728762
"I used to have an open mind but || Get yer free open source RTOS's here...
 my brains kept falling out."    || http://sourceware.cygnus.com/ecos
Help fight spam! http://spam.abuse.net/  These opinions are all my own fault

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

* RE: [ECOS] LIBC and STDIO
  1999-12-17 12:23     ` Jonathan Larmour
@ 1999-12-17 16:05       ` Perry Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Perry Wang @ 1999-12-17 16:05 UTC (permalink / raw)
  To: jlarmour; +Cc: ecos-discuss

Hi Mr. Larmour,

I don't know what did it, but after downloading and setting up the latest
CVS source tree, the printf works with "/dev/tty1"

thanks for all the help.  appreciate it.

btw, that gdb/sniffing really sounds impressive.  I used to only use it for
hacking purpose :)

regards,

Perry

> -----Original Message-----
> From: jlarmour@cygnus.co.uk [ mailto:jlarmour@cygnus.co.uk ]
> Sent: Friday, December 17, 1999 12:23 PM
> To: Perry Wang
> Cc: jskov@cygnus.co.uk; ecos-discuss@sourceware.cygnus.com
> Subject: Re: [ECOS] LIBC and STDIO
>
>
> Perry Wang wrote:
> >
> > I do have the serial package enabled.. some of the defines are here:
> >
> [snip]
> > io write to /dev/tty1 or /dev/ser1 directly works fine.
> However the libc
> > printf doesn't like it.  I guess I'm still missing something.  Changing
> > CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE back to "/dev/haldiag" will
> work, but it
> > prints out some garbage only GDB will understand.
>
> I suppose it isn't very helpful for me to say that I just tried it here on
> an AEB-1B and (from what I could tell[1]) I could run the libc stdiooutput
> test fine.
>
> Have you tried the other serial line? It could be some conflict
> between the
> hal diag initialization and the serial driver initialization - we've had
> such things happen before. If that doesn't work either, it at least gives
> you the chance to debug it (using GDB attached to the first
> serial line) to
> see what is going on.
>
> [1] For reasons to long to explain, I connected with GDB over a TCP
> connection to a proxy test server, and used an ethernet packet
> sniffer since
> GDB silently discards anything not in remote protocol packets. Yes, I'm
> lazy.
>
> Jifl
> --
> Cygnus Solutions, 35 Cambridge Place, Cambridge, UK.  Tel: +44
> (1223) 728762
> "I used to have an open mind but || Get yer free open source
> RTOS's here...
>  my brains kept falling out."    || http://sourceware.cygnus.com/ecos
> Help fight spam! http://spam.abuse.net/  These opinions are all
> my own fault

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

* [ECOS] tty driver
  1999-12-17 11:04   ` Perry Wang
  1999-12-17 12:23     ` Jonathan Larmour
@ 1999-12-21 14:51     ` Perry Wang
  1999-12-21 14:56       ` Perry Wang
  1 sibling, 1 reply; 7+ messages in thread
From: Perry Wang @ 1999-12-21 14:51 UTC (permalink / raw)
  To: ecos-discuss

The current tty driver source echos backspace even if it's already at the
beginning of the line.

Also, cyg_io_read returns -1 when user send backspace at the beginning of
the line.  This is self-explanatory if you look at the code.

Here is the fix.  Please let me know if all this is unnecessary.  I would
prefer not having to change the eCos source.


--------------


[root@mail common]# diff -u tty.c.orig tty.c
--- tty.c.orig  Tue Dec 21 14:17:14 1999
+++ tty.c       Tue Dec 21 14:44:19 1999
@@ -191,7 +191,8 @@
     cyg_devtab_entry_t *t = (cyg_devtab_entry_t *)handle;
     struct tty_private_info *priv = (struct tty_private_info *)t->priv;
     cyg_io_handle_t chan = (cyg_io_handle_t)priv->dev_handle;
-    cyg_uint32 size, clen;
+    cyg_int32 size;
+    cyg_uint32 clen;
     Cyg_ErrNo res;
     cyg_uint8 c;
     cyg_uint8 *buf = (cyg_uint8 *)_buf;
@@ -208,8 +209,11 @@
         if ((priv->dev_info.tty_in_flags & CYG_TTY_IN_FLAGS_BINARY) == 0) {
             if ((c == '\b') || (c == 0x7F)) {
                 size -= 2;  // erase one character + 'backspace' char
-                if (size < 0) size = 0;
-                if (priv->dev_info.tty_in_flags & CYG_TTY_IN_FLAGS_ECHO) {
+                if (size < 0) {  // beginning of the line, don't echo \b
+                    size = 0;
+                } else if (priv->dev_info.tty_in_flags &
+                           CYG_TTY_IN_FLAGS_ECHO)
+                {
                     clen = 3;
                     cyg_io_write(chan, "\b \b", &clen);
                 }

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

* RE: [ECOS] tty driver
  1999-12-21 14:51     ` [ECOS] tty driver Perry Wang
@ 1999-12-21 14:56       ` Perry Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Perry Wang @ 1999-12-21 14:56 UTC (permalink / raw)
  To: ecos-discuss

> Also, cyg_io_read returns -1 when user send backspace at the beginning of
> the line.  This is self-explanatory if you look at the code.

I meant to say that cyg_io_read writes back -1 (or whatever it equates to as
unsigned) to the "len" parameter.

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

end of thread, other threads:[~1999-12-21 14:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-16 16:35 [ECOS] LIBC and STDIO Perry Wang
1999-12-17  0:30 ` Jesper Skov
1999-12-17 11:04   ` Perry Wang
1999-12-17 12:23     ` Jonathan Larmour
1999-12-17 16:05       ` Perry Wang
1999-12-21 14:51     ` [ECOS] tty driver Perry Wang
1999-12-21 14:56       ` Perry Wang

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).