public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] assertion error in stdio
@ 2000-07-10 14:22 James Kahkoska
  2000-07-11  6:37 ` Bart Veer
  0 siblings, 1 reply; 3+ messages in thread
From: James Kahkoska @ 2000-07-10 14:22 UTC (permalink / raw)
  To: ecos-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2254 bytes --]

I am having a problem with eCos when I turn on 
asserts in eCos. I thought everything I/O related was working ok but when I 
turn on assertions, I get the following assertion error:
 
ASSERT FAIL: 
stream.cxx          [  79] 
Cyg_StdioStream::Cyg_StdioStream() Attempt to open invalid 
device!
 
The call stack looks 
like hal_misc.c\cyg_hal_invoke_constructors() Line #92 (0x0001C930)   
stdout.cxx\global constructors keyed to 50000.cyg_libc_stdio_stdout() Line #90 
(0x00020240)     
stdiofiles.inl\__static_initialization_and_destruction_0() Line #83 
(0x000200DC)       
stream.cxx\Cyg_StdioStream::Cyg_StdioStream(void *, Cyg_StdioStream::OpenMode, 
bool, bool, int, unsigned int, unsigned char *)() Line #82 
(0x00020328)         
buffer.cxx\cyg_assert_fail() Line #741 (0x0001DE84)
 
It appears the Cyg_StdioStream::Cyg_StdioStream 
contructor is being passed a NULL for the device and the assertion catches 
that. I went further into the code and this originates in stdout.cxx 
cyg_libc_stdio_stdout() Line #90
 
  // And here's an instance of the class just 
to make the code run   static cyg_libc_dummy_stdout_init_class 
cyg_libc_dummy_stdout_init    
                                       
CYG_INIT_PRIORITY(LIBC)
 
The constructor ends up calling calling  

 
  Cyg_libc_stdio_files::set_file_stream( fd_t 
fd, Cyg_StdioStream *stream )
 
which invokes the 
Cyg_StdioStream::Cyg_StdioStream(cyg_io_handle_t dev, constructor with a null 
device.      CYG_CHECK_DATA_PTR(dev, "Attempt to open 
invalid device!");
 
Without asserts enabled my printf's to stdout seem 
to work fine. I am not sure about this dummy class and single static instance 
that causes the assertion to fail. The comment is my only clue to it's 
existence:
 
// This is a dummy class just so we can execute 
arbitrary code when // stdout is requested
 
Any ideas as to why I need this dummy class or why 
it might be blowing up?
 
Thanks, James
 
 
James Kahkoska jkahkoska@wire-less-inc.com 719-528-8885 
x104

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

* Re: [ECOS] assertion error in stdio
  2000-07-10 14:22 [ECOS] assertion error in stdio James Kahkoska
@ 2000-07-11  6:37 ` Bart Veer
  2000-07-11  6:43   ` Dave Airlie
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Veer @ 2000-07-11  6:37 UTC (permalink / raw)
  To: jkahkoska; +Cc: ecos-discuss

>>>>> "James" == James Kahkoska <jkahkoska@wire-less-inc.com> writes:

    James> I am having a problem with eCos when I turn on asserts in
    James> eCos. I thought everything I/O related was working ok but
    James> when I turn on assertions, I get the following assertion
    James> error:

    <snip>

I am not an expert on this part of the system, but I can give a couple
of pointers.

All C library streams, including stdout, need to be mapped to an
underlying stream device such as "/dev/ttydiag". stdout is unusual in
that it needs to exist and be usable by the time the application gets
started, so it is necessary to select the target device at eCos
compile-time. This is achieved by the C library configuration option
CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE.

If at initialization time the device specified by this configuration
option is absent then you should get an assertion failure. Ideally it
would be possible to check at configure-time that the selected device
is going to be present, but that would require some CDL extensions. In
addition it would be necessary to cope with the possibility that the
default stdout device is provided by application code rather than by
an eCos package. 

So either CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE has been changed so that
it no longer corresponds to a valid device name, or you have disabled
the device driver corresponding to the default value. This default
value is "/dev/ttydiag", which should be provided by the common serial
package CYGPKG_IO_SERIAL. If you remove this common serial package
from the configuration then you are responsible for providing an
alternative stdout device. Note that it should always be possible for
the common serial package to provide at least one device which uses
the low-level HAL diagnostics routines to send output to the user
(whether by flashing morse code on an LED, or by other means).
Alternatively you may have manipulated a configuration option such as
CYGPKG_IO_SERIAL_TTY, CYGDAT_IO_SERIAL_TTY_CONSOLE or
CYGPKG_IO_SERIAL_TTY_TTYDIAG, and thus disabled or renamed
"/dev/ttydiag".

Anyway, the C library has been configured to use a particular device
for stdout and that device is not present at the time that stdout gets
initialized. Hopefully that will help you to figure out what is going
on in your specific case.

Bart Veer // eCos net maintainer

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

* Re: [ECOS] assertion error in stdio
  2000-07-11  6:37 ` Bart Veer
@ 2000-07-11  6:43   ` Dave Airlie
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Airlie @ 2000-07-11  6:43 UTC (permalink / raw)
  To: Bart Veer; +Cc: jkahkoska, ecos-discuss

I at one stage called printf in some driver init code which was called
before libc was initialised.. I think I got a similiar style error...

just in case this may have something to do with it..

Dave.
On Tue, 11 Jul 2000, Bart Veer wrote:

> >>>>> "James" == James Kahkoska <jkahkoska@wire-less-inc.com> writes:
> 
>     James> I am having a problem with eCos when I turn on asserts in
>     James> eCos. I thought everything I/O related was working ok but
>     James> when I turn on assertions, I get the following assertion
>     James> error:
> 
>     <snip>
> 
> I am not an expert on this part of the system, but I can give a couple
> of pointers.
> 

-- 
      David Airlie, Software Engineer, Parthus Technologies plc.,
       Mary Rosse Centre, National Tech Park, Limerick, Ireland.
   t: +353-61-508116 / f: +353-61-508101 / David.Airlie@parthus.com

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

end of thread, other threads:[~2000-07-11  6:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-10 14:22 [ECOS] assertion error in stdio James Kahkoska
2000-07-11  6:37 ` Bart Veer
2000-07-11  6:43   ` Dave Airlie

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