RTEMS on QEMU with virtual serial device

Олег Мороз oleg.moroz at mcc.vniiem.ru
Sun Sep 28 07:52:12 UTC 2014


Hello everyone, i'm trying to develop RTEMS app using QEMU VM. How can i 
use virtual serial device for two side data exchange between VM and host 
machine. I'm trying to use it in that way:



#include <bsp.h> /* for device driver prototypes */

#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
#define CONFIGURE_APPLICATION_EXTRA_DRIVERS  TTY2_DRIVER_TABLE_ENTRY
#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 6

#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
.....


then in my app i'm trying to open /dev/ttyS2 device

   unsigned char data[4] = {1,2,3,4};
   int f =open("/dev/ttyS2", O_RDWR | O_NOCTTY | _FNDELAY);
   if (f>0)
   {
       printf("write data %d\n",write(f,data,4));
   }

then start QEMU
qemu-system-i386 -serial file:/tmp/1.txt -kernel zvezda_shell.exe


In QEMU shell i've seen
Device: /dev/ttyS2 initialized.
write data 4

But in fact file /tmp/1.txt has no data. How can i solve it and use QEMU 
-serial for both side data exchange?


More information about the devel mailing list