[ECOS] assertion error in stdio

James Kahkoska jkahkoska@wire-less-inc.com
Mon Jul 10 14:22:00 GMT 2000


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



More information about the Ecos-discuss mailing list