termios breakage on LM32

Sebastien Bourdeauducq sebastien at milkymist.org
Sat Jul 30 13:43:07 UTC 2011


Hi,

I'm trying to port my drivers to CVS head, but on top of the irritating
but minor zlib issue, I get serious problems with the console (which now
uses the termios system). I have a system freeze after about a dozen
characters are written to the console, with the typical stack traces
below.

The termios code calls:
  rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
which results in a fatal error because
_Thread_Dispatch_in_critical_section() returns true.

Any guesses about the origin of this problem? All the console device
driver does is call the termios functions, as you can see on:
https://github.com/milkymist/rtems/blob/mmstaging/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c

(of course, this pesky bug only manifests itself on the board and never
in QEMU, probably because of different timings...)

Thanks,
Sébastien

#0  0x4010448c in _System_state_Set (the_source=<value optimized out>,
is_internal=<value optimized out>, the_error=<value optimized out>)
at ../../cpukit/../../../milkymist/lib/include/rtems/score/sysstate.inl:37
#1  _Internal_error_Occurred (the_source=<value optimized out>,
is_internal=<value optimized out>, the_error=<value optimized out>)
    at ../../../../../../rtems/c/src/../../cpukit/score/src/interr.c:58
#2  0x401022d0 in rtems_semaphore_obtain (id=436273162, option_set=0,
timeout=0)
at ../../../../../../rtems/c/src/../../cpukit/rtems/src/semobtain.c:82
#3  0x400e6368 in rtems_termios_ioctl (arg=0x408ed398)
at ../../../../../../rtems/c/src/../../cpukit/libcsupport/src/termios.c:521
#4  0x400d887c in console_control (major=<value optimized out>,
minor=<value optimized out>, arg=<value optimized out>)
at ../../../../../../../../rtems/c/src/lib/libbsp/lm32/milkymist/../../lm32/shared/milkymist_console/console.c:219
#5  0x40102d24 in rtems_io_control (major=<value optimized out>,
minor=<value optimized out>, argument=<value optimized out>)
at ../../../../../../rtems/c/src/../../cpukit/sapi/src/iocontrol.c:47
#6  0x40147d9c in device_ioctl (iop=<value optimized out>,
command=<value optimized out>, buffer=<value optimized out>)
at ../../../../../../rtems/c/src/../../cpukit/libfs/src/imfs/deviceio.c:186
#7  0x400e3be4 in ioctl (fd=<value optimized out>, command=1099801888)
at ../../../../../../rtems/c/src/../../cpukit/libcsupport/src/ioctl.c:50
#8  0x4012858c in tcgetattr (fd=<value optimized out>, tp=<value
optimized out>)
at ../../../../../../rtems/c/src/../../cpukit/libcsupport/src/tcgetattr.c:34
#9  0x401138a0 in rtems_shell_main_loop (shell_env_arg=0x418da520)
at ../../../../../../rtems/c/src/../../cpukit/libmisc/shell/shell.c:655
#10 0x4011449c in rtems_shell_task (task_argument=<value optimized out>)
at ../../../../../../rtems/c/src/../../cpukit/libmisc/shell/shell.c:557
#11 0x4014cb14 in _Thread_Handler ()
at ../../../../../../rtems/c/src/../../cpukit/score/src/threadhandler.c:157
#12 0x4014ca88 in _Heap_Get_information (the_heap=<value optimized out>,
the_info=0x5)
at ../../../../../../rtems/c/src/../../cpukit/score/src/heapgetinfo.c:57


#0  0x40104478 in _System_state_Set (the_source=<value optimized out>,
is_internal=<value optimized out>, the_error=<value optimized out>)
at ../../cpukit/../../../milkymist/lib/include/rtems/score/sysstate.inl:37
#1  _Internal_error_Occurred (the_source=<value optimized out>,
is_internal=<value optimized out>, the_error=<value optimized out>)
    at ../../../../../../rtems/c/src/../../cpukit/score/src/interr.c:58
#2  0x401022bc in rtems_semaphore_obtain (id=436273162, option_set=0,
timeout=0)
at ../../../../../../rtems/c/src/../../cpukit/rtems/src/semobtain.c:82
#3  0x400e6f94 in rtems_termios_write (arg=0x408ed32c)
at ../../../../../../rtems/c/src/../../cpukit/libcsupport/src/termios.c:749
#4  0x400d8860 in console_write (major=<value optimized out>,
minor=<value optimized out>, arg=<value optimized out>)
at ../../../../../../../../rtems/c/src/lib/libbsp/lm32/milkymist/../../lm32/shared/milkymist_console/console.c:210
#5  0x40103134 in rtems_io_write (major=<value optimized out>,
minor=<value optimized out>, argument=<value optimized out>)
    at ../../../../../../rtems/c/src/../../cpukit/sapi/src/iowrite.c:47
#6  0x40147d38 in device_write (iop=<value optimized out>, buffer=<value
optimized out>, count=<value optimized out>)
at ../../../../../../rtems/c/src/../../cpukit/libfs/src/imfs/deviceio.c:152
#7  0x400e82ec in write (fd=<value optimized out>, buffer=<value
optimized out>, count=<value optimized out>)
at ../../../../../../rtems/c/src/../../cpukit/libcsupport/src/write.c:47
#8  0x4016e2b4 in _write_r (ptr=<value optimized out>, fd=<value
optimized out>, buf=<value optimized out>, nbytes=<value optimized out>)
at ../../../../../../rtems/c/src/../../cpukit/libcsupport/src/write_r.c:38
#9  0x4015922c in __swrite (ptr=0x408ed768, cookie=0x408edb24,
buf=0x4019ea00 "shell:cannot allocate prompt memory\n", n=36)
    at ../../../../../../../gcc-4.5.3/newlib/libc/stdio/stdio.c:97
#10 0x40154304 in __sfvwrite_r (ptr=0x408ed768, fp=0x408edb24,
uio=0x408ed3b4)
at ../../../../../../../gcc-4.5.3/newlib/libc/stdio/fvwrite.c:97
#11 0x40154908 in _fwrite_r (ptr=0x408ed768, buf=<value optimized out>,
size=1, count=36, fp=<value optimized out>)
    at ../../../../../../../gcc-4.5.3/newlib/libc/stdio/fwrite.c:124
#12 0x40154984 in fwrite (buf=<value optimized out>, size=<value
optimized out>, count=<value optimized out>, fp=<value optimized out>)
    at ../../../../../../../gcc-4.5.3/newlib/libc/stdio/fwrite.c:141
#13 0x401142e8 in rtems_shell_main_loop (shell_env_arg=0x418da520)
at ../../../../../../rtems/c/src/../../cpukit/libmisc/shell/shell.c:672
#14 0x40114488 in rtems_shell_task (task_argument=<value optimized out>)
at ../../../../../../rtems/c/src/../../cpukit/libmisc/shell/shell.c:557
#15 0x4014cb00 in _Thread_Handler ()
at ../../../../../../rtems/c/src/../../cpukit/score/src/threadhandler.c:157
#16 0x4014ca74 in _Heap_Get_information (the_heap=<value optimized out>,
the_info=0x5)
at ../../../../../../rtems/c/src/../../cpukit/score/src/heapgetinfo.c:57





More information about the users mailing list