This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Re: how to build a driver to a single library
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Tianjun - zdk <Tianjun at zcom dot unimis dot com>
- Cc: "ecos-discuss at sources dot redhat dot com" <ecos-discuss at sources dot redhat dot com>
- Date: Tue, 19 Jul 2005 09:17:39 +0200
- Subject: Re: Re: [ECOS] how to build a driver to a single library
- References: <NETWEB05VJi0LJEwN9G0000d107@netweb05.net.unimis>
On Tue, Jul 19, 2005 at 09:14:47AM +0800, Tianjun - zdk wrote:
> >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;
This is effectively a nop, a no operation. But the compiler will do
it, so forcing a reference to the symbol ebsa285_serial_io. This means
the linker is forced to include the symbol in the application.
You want to do something similar with your driver otherwise the link
may decide to not include it in the application.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss