[ECOS] creating serial driver

Gary Thomas gary@mlbassoc.com
Fri Oct 28 13:37:00 GMT 2005


On Fri, 2005-10-28 at 04:46 -0700, venkat ande wrote:
> Hello Andrew sir,
> 
> i have already included the <cyg/io/serial.h> in both
> the driver code (serial.c) and application code
> (serial_app.c). Just now i did one exp. , i commented
> the header <cyg/io/serial.h> in application file, but
> even after that i am getting the same errors. Where as
> i think it must give some error like :symbol
> cyg_devtab_entry_t not found or unknown. 
> 
> Please suggest, what could be the problem.

Did you try looking for the definition of that symbol?
e.g. 
  find .../ecos/packages -name "*.h*" -exec grep cyg_devtab_entry_t \{} \;

Hint: You need to include <cyg/io/devtab.h>

> 
> And many many thanks for the immediate response sir.
> 
> Regards,
> VENKAT
> --- Andrew Lunn <andrew@lunn.ch> wrote:
> 
> > On Fri, Oct 28, 2005 at 02:50:50AM -0700, venkat
> > ande wrote:
> > > Hello all,
> > > 
> > > I am having a x86 PC board with running redboot in
> > > it.I have to add around 16 serial ports to my x86
> > PC
> > > board using PCI bus. But as a rookie i am first
> > trying
> > > to make a driver for  a single port.So what i did,
> > i
> > > created a driver by using the generic driver of
> > 16x5x.
> > > But i didn't place it inside the ecos tree. I made
> > it
> > > as an application in which i used all those macros
> > > DEVTAB_ENTRY, SERIAL_CHANNEL_USING_INTERRUPTS,
> > > SERIAL_FUNS and then filled the api's with
> > reference
> > > to the pattern of 16x5x driver.
> > > 
> > > Then i made one more application to test this
> > driver
> > > using the ?ecos-2.0\examples\serial.c? (i replaced
> > the
> > > ?/dev/haldiag? by ?/dev/FT_ser_drv?), FT_ser_drv
> > is
> > > the string name that i given to my driver.
> > > 
> > > Now how i am building my last output file (srec).
> > > Actually i found this method in ecos discuss
> > archives,
> > > i am pasting that part here:
> > > 
> > > -------------------------------------
> > > 
> > > >Anyway, build your device driver library just
> > like an
> > > eCos
> > > >application, but instead of linking it to eCos
> > just
> > > use ar to create a
> > > >library from the object file. There is nothing
> > > special needed, so just
> > > >look at normal examples for building libraries.
> > > >
> > > >To link the libarary to the application and eCos
> > just
> > > add -lmylib to
> > > >the command line when linking. ie nothing special
> > or
> > > magical needed.
> > > >
> > > >OK, now the thing to be careful of. When building
> > a
> > > device driver
> > > >within the eCos tree there is normally a cdl
> > option: 
> > > >
> > > >  compile       -library=libextras.a   foobar.c
> > > >
> > > >ie the object file is put into the library
> > > libextras.a not the normal
> > > >libtarget.a. At the end of the build process
> > > libextras.a is linked to
> > > >extras.o and this is then linked to your
> > application,
> > > not
> > > >libextras.a. This is becasue the linker throws
> > away
> > > any symbols not
> > > >referenced in libraries. Normally there is no
> > > reference to a device
> > > >driver because of the use of linker tables. So if
> > the
> > > device driver
> > > >was inside a library it would not be pulled into
> > the
> > > final application
> > > >executable. 
> > > >
> > > >For your device driver in your library you cannot
> > use
> > > the same
> > > >trick. So instead your application must reference
> > > something in the
> > > >device driver so that it is pulled in. Typically
> > a
> > > device driver has a
> > > >DEVTAB_ENTRY, eg
> > > >
> > > >DEVTAB_ENTRY(ebsa285_serial_io,
> > > >            
> > > CYGDAT_IO_SERIAL_ARM_EBSA285_SERIAL_NAME,
> > > >             0,                     // Does not
> > > depend on a lower level interface
> > > >             &cyg_io_serial_devio,
> > > >             ebsa285_serial_init,
> > > >             ebsa285_serial_lookup,     // Serial
> > > driver may need initializing
> > > >             &ebsa285_serial_channel
> > > >    );
> > > >
> > > >Doing something like:
> > > >
> > > >  extern cyg_devtab_entry_t *ebsa285_serial_io;
> > > >  ebsa285_serial_io = ebsa285_serial_io;
> > > >
> > > >will probably be enought.
> > > -----------------------------------------------
> > > 
> > > 
> > > in my case i am using ?FT_ser_ent? in place of
> > > ?ebsa285_serial_io? & FT_SER_DRV_NAME in place of
> > > CYGDAT_IO_SERIAL_ARM_EBSA285_SERIAL_NAME.
> > > 
> > > Where as FT_SER_DRV_NAME is defined as:
> > > 
> > > #define FT_SER_DRV_NAME	"\"/dev/FT_ser_drv\""
> > > 
> > > 
> > > 
> > > and also i have added this in my application file 
> > :
> > > ------------------------------------------
> > >  extern cyg_devtab_entry_t *FT_ser_ent
> > >  FT_ser_ent = FT_ser_ent;
> > > ------------------------------------------
> > 
> > 
> > > serial_app.c:80: warning: type defaults to `int'
> > in
> > > declaration of `FT_ser_ent'
> > > serial_app.c:80: conflicting types for
> > `FT_ser_ent'
> > > serial_app.c:79: previous declaration of
> > `FT_ser_ent'
> > > serial_app.c:80: initializer element is not
> > constant
> > > serial_app.c:80: warning: data definition has no
> > type
> > > or storage class
> > > make: *** [serial_app.o] Error 1
> > 
> > You need to fix this. My guess is cyg_devtab_entry_t
> > is not known
> > because you are missing a header file. Try including
> > <cyg/io/serial.h>
> > 
> >         Andrew
> > 
> 
> 
> 
> 	
> 		
> __________________________________ 
> Yahoo! Mail - PC Magazine Editors' Choice 2005 
> http://mail.yahoo.com

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list