Two UARTS

Joel Sherrill joel.sherrill at oarcorp.com
Fri Aug 31 10:45:11 CDT 2007


Aitor.Viana.Sanchez at esa.int wrote:
>
> Yep, I explained in a hard way...let me try again.
>
> The problem was that I called rtems_filesystem_initialize() before 
> calling the fopen routine, and that provoked the error later on. When 
> I removed the rtems_filesystem_initialize everything worked fine.
>
> My question, basically is...why it happens?
Hopefully you weren't calling it yourself in YOUR code.  If so,
you were calling it for the second time.   It is called
automatically as part of initializing the system call infrastructure.
Specifically it is called as part of rtems_libio_init which initializes
the set of file descriptors.

If this is the problem, it is a new one to me. 

--joel
>
> Aitor
>
>
> Joel Sherrill <joel.sherrill at oarcorp.com> wrote on 31/08/2007 17:01:36:
>
> > Aitor.Viana.Sanchez at esa.int wrote:
> > >
> > > OK, got it.
> > >
> > > I called previously to rtems_filesystem_initialize(), and this routine
> > > provoked the error after.
> > > The question I have now is, Can we not to have the IMFS and use also
> > > the console and console_b in that way simultaneously?
> > >
> > >
> > Bad English here..  "not" in a confusing place. :)
>
> > Is the filesystem initialized or not?  Have you stubbed it out?
>
> > The filesystem must be initialized before the console_initialize call
> > but that
> > happens normally.
>
> > The device name/nodes only exist in the filesystem.  They filesystem 
> has to
> > work or you wouldn't get to register the device name.
>
> > --joel
> > >
> > > Cheers,
> > >
> > >         Aitor
> > >
> > > rtems-users-bounces+aitor.viana.sanchez=esa.int at rtems.org wrote on
> > > 31/08/2007 16:28:57:
> > >
> > > > Joel Sherrill <joel.sherrill at oarcorp.com> wrote on 31/08/2007 
> 16:24:38:
> > > >
> > > > > Aitor.Viana.Sanchez at esa.int wrote:
> > > > > >
> > > > > > The same behaviour happens also if I change the "/dev/console_b"
> > > for
> > > > > > "/dev/console" device in the fopen call.
> > > > > >
> > > > > > There is also something strange: If the "r+" option is set, "no
> > > such
> > > > > > device" error is raised but if "w+" is set instead, no error is
> > > raised
> > > > > > but the fprintf call does not printf anything anyway.
> > > > > Break at _open_r() and step through.  fopen() doesn't fail in this
> > > way.
> > > >
> > > > Yes. My fault...in this mode the fopen call does not fail...is not
> > > > strange at all ;)
> > > >
> > > > > >
> > > > > > In the RTEMS configuration file the option
> > > > > >
> > > > > >         #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
> > > > > >
> > > > > > is set as well.
> > > > > >
> > > > > So the driver is there. Good.
> > > > Yep.
> > > >
> > > > I will try to figure out why I cannot write on console_b
> > > >
> > > > Cheers,
> > > >         Aitor
> > > >
> > > > > >
> > > > > > Aitor
> > > > > >
> > > > > >
> > > > > >
> > > > > > *Joel Sherrill <joel.sherrill at oarcorp.com>*
> > > > > > Sent by: 
> rtems-users-bounces+aitor.viana.sanchez=esa.int at rtems.org
> > > > > >
> > > > > > 31/08/2007 16:13
> > > > > >
> > > > > >
> > > > > > To
> > > > > >  Aitor.Viana.Sanchez at esa.int
> > > > > > cc
> > > > > >  RTEMS Users <rtems-users at rtems.org>
> > > > > > Subject
> > > > > >  Re: Two UARTS
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Aitor.Viana.Sanchez at esa.int wrote:
> > > > > > >
> > > > > > > OK,
> > > > > > >
> > > > > > > I already tried with this code.
> > > > > > >
> > > > > > >        fp = fopen("/dev/console_b", "r+");
> > > > > > >         if(fp == NULL)
> > > > > > >             std::cout << strerror(errno) << std::endl;
> > > > > > >
> > > > > > > ....
> > > > > > >
> > > > > > >     fprintf(fp, string);
> > > > > > >     fflush(fp);
> > > > > > >
> > > > > > > where string is a char* passed as an argument to the routine
> > > > > > > containing the fprintf.
> > > > > > >
> > > > > > > The problem is that the fopen routine returns "No such file or
> > > > > > > directory" error.
> > > > > > >
> > > > > > > In the RTEMS configuration file this options are specified
> > > > > > >
> > > > > > > #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS    10
> > > > > > > #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS           2
> > > > > > > #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
> > > > > > >
> > > > > > >
> > > > > > > In principle, as far as I read, should work, but it does 
> not. Has
> > > > > > > anybody any clue?
> > > > > > >
> > > > > > >
> > > > > > Looking at the CVS head, there is no obvious reason in the leon2
> > > device
> > > > > > driver that the /dev/console would work if /dev/console_b
> > > doesn't.   I
> > > > > > would recommend stepping into console_open() and seeing what
> > > happens.
> > > > > >
> > > > > > I assume you still have the console device driver configured
> > > since they
> > > > > > are in the same driver.
> > > > > >
> > > > > > --joel
> > > > > > > Cheers,
> > > > > > >         Aitor
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > *Aitor.Viana.Sanchez at esa.int*
> > > > > > > Sent by:
> > > rtems-users-bounces+aitor.viana.sanchez=esa.int at rtems.org
> > > > > > >
> > > > > > > 31/08/2007 15:21
> > > > > > >
> > > > > > >
> > > > > > > To
> > > > > > >         Aitor.Viana.Sanchez at esa.int
> > > > > > > cc
> > > > > > >         RTEMS Users <rtems-users at rtems.org>
> > > > > > > Subject
> > > > > > >         Re: Two UARTS
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > could be using the devices /dev/console and /dev/console_b
> > > > > > >
> > > > > > > Cheers
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > *Aitor.Viana.Sanchez at esa.int*
> > > > > > > Sent by:
> > > rtems-users-bounces+aitor.viana.sanchez=esa.int at rtems.org
> > > > > > >
> > > > > > > 31/08/2007 15:16
> > > > > > > To
> > > > > > >         RTEMS Users <rtems-users at rtems.org>
> > > > > > > cc
> > > > > > >
> > > > > > > Subject
> > > > > > >         Two UARTS
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Hi everyone,
> > > > > > >
> > > > > > > I've got, for sure, and stupid question. I am working with the
> > > RTEMS
> > > > > > > for LEON architecture. I know that the standard output is
> > > connected
> > > > > > > with the UART1, but I also have an UART2. I would like, from a
> > > user
> > > > > > > application, to send some trace information out through the
> > > > > > > UART2...which the easiest way to do that?
> > > > > > >
> > > > > > > Cheers,
> > > > > > >         Aitor
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > _______________________________________________
> > > > > > rtems-users mailing list
> > > > > > rtems-users at rtems.com
> > > > > > http://rtems.rtems.org/mailman/listinfo/rtems-users
> > > > _______________________________________________
> > > > rtems-users mailing list
> > > > rtems-users at rtems.com
> > > > http://rtems.rtems.org/mailman/listinfo/rtems-users 




More information about the rtems-users mailing list