pc386 BSP: printk apparently outputs on the same serial port as the console ?

Simon Clubley simon.clubley at googlemail.com
Mon May 25 16:22:23 UTC 2009


Hello,

I'm looking at the changes I made manually in the (old) version of
RTEMS I am currently using (as part of the process of moving to RTEMS
4.9.2) and I rediscovered an issue with the pc386 BSP apparently
emitting printk() output on the same serial port as the console (when
serial port I/O is the chosen console method) regardless of the serial
port settings in console.c.

Here is my walkthrough of what I _think_  is happening (I've omitted
some top level directories in the paths):

cpukit/libcsupport/src/printk.c contains the support for printk() and
printk() calls BSP_output_char() to perform the actual write.

BSP_output_char() is defined (for pc386) in
libbsp/i386/pc386/console/console.c to point to either
BSP_output_char_via_serial() or _IBMPC_outch() depending on the
contents of BSPPrintkPort.

BSP_output_char_via_serial() is defined in
libbsp/i386/shared/comm/uart.c. However, BSP_output_char_via_serial()
uses the contents of BSPConsolePort, and not BSPPrintkPort, to output
the character via BSP_uart_polled_write().

This means that even if you define BSPConsolePort = BSP_UART_COM2 and
BSPPrintkPort = BSP_UART_COM1, both the console and printk() output
will end up been transmitted on the same port.

Is my understanding correct ?

My patch BTW, just forces uart.c to output via BSPPrintkPort (after
defining it as an extern variable) instead of via BSPConsolePort.

I don't know if this would be acceptable as a general fix for this
problem - the uart.c code is sharable with all the i386 BSPs and I
don't know if all of them define BSPPrintkPort (or set it up
correctly). There may also be other uses of
BSP_output_char_via_serial() other than
within printk().

Simon.

-- 
Simon Clubley
simon.clubley at googlemail.com



More information about the users mailing list