[ECOS] Help linking device driver
Gary Thomas
gary@mlbassoc.com
Sat Dec 4 11:11:00 GMT 2004
On Fri, 2004-12-03 at 21:24, David Brennan wrote:
> I have converted a portion of my application device driver to be an eCos
> device driver. But I am having trouble getting it to link with my
> application. I defined the device io and devtab entries, but that alone
> doesn't seem to be enough to get my new object module to get pulled into
> the main application. Is there a trick to getting that to work?
>
> Code snippets:
> BLOCK_DEVIO_TABLE(cyg_io_vme_devio,
> cyg_devio_bwrite,
> cyg_devio_bread,
> cyg_devio_select,
> vme_get_config,
> vme_set_config
> );
>
> BLOCK_DEVTAB_ENTRY(vme_devtab_io,
> CYGDAT_IO_VME_UNIVERSE_NAME,
> 0,
> &cyg_io_vme_devio,
> universe_init,
> universe_lookup,
> &universe_data);
>
> If I check the libtarget.a, the symbols are all in there.
> $ i386-elf-objdump -x ../eCos/install/lib/libtarget.a | fgrep universe_
> io_vme_universe_universe.o: file format elf32-i386
> rw-r--r-- 14112/10545 41724 Dec 3 17:30 2004 io_vme_universe_universe.o
> 8 .text.universe_lookup 00000007 00000000 00000000 00007860 2**2
> 9 .text.universe_init 00000136 00000000 00000000 00007868 2**2
> 00000000 l F .text.universe_init 00000136 universe_init
> 00000000 l F .text.universe_lookup 00000007 universe_lookup
> 00000000 l O .bss 000000f8 universe_data
> 00000000 l d .text.universe_lookup 00000000
> 00000000 l d .text.universe_init 00000000
> 00000cf8 R_386_32 .text.universe_lookup
> 00000d4c R_386_32 .text.universe_init
> 0000000c R_386_32 .text.universe_init
> 00000010 R_386_32 .text.universe_lookup
> RELOCATION RECORDS FOR [.text.universe_init]:
> io_vme_universe_vme_master.o: file format elf32-i386
> rw-r--r-- 14112/10545 36356 Dec 3 17:30 2004 io_vme_universe_vme_master.o
>
> But after linking libtarget into my application, none of the symbols
> seem to have been pulled in. (I'm not sure of the most correct way of
> checking for a library, but as a test I did:
> $ i386-elf-objdump -x app.out | fgrep pc_serial_
> 00352e34 l O .data 00000014 pc_serial_funs
> 0027d600 l F .text 00000030 pc_serial_putc
> 0027d630 l F .text 00000024 pc_serial_getc
> 0027d654 l F .text 00000044 pc_serial_set_config
> 0027d698 l F .text 00000015 pc_serial_start_xmit
> 0027d6b0 l F .text 00000015 pc_serial_stop_xmit
> 00352ea0 l O .data 0000002c pc_serial_info0
> 00352ee0 l O .data 000000cc pc_serial_channel0
> 0038b240 l O .bss 00000080 pc_serial_out_buf0
> 0038b2c0 l O .bss 00000080 pc_serial_in_buf0
> 0027d574 l F .text 00000073 pc_serial_init
> 0027d5e8 l F .text 00000018 pc_serial_lookup
> 00352fc0 l O .data 0000002c pc_serial_info1
> 00353000 l O .data 000000cc pc_serial_channel1
> 0038b340 l O .bss 00000080 pc_serial_out_buf1
> 0038b3c0 l O .bss 00000080 pc_serial_in_buf1
> 0027d6f0 l F .text 00000202 pc_serial_DSR
> 0027d6c8 l F .text 00000028 pc_serial_ISR
> 00355520 g O .data 00000020 pc_serial_io0
> 00355540 g O .data 00000020 pc_serial_io1
>
> But
> $ i386-elf-objdump -x app.out | fgrep vme_
> yields nothing.
>
> So I'm pretty sure my device is not being linked in. Any help would be
> greatly appreciated.
Device drivers need to be in libextras.a (for just this reason).
Change your CDL to look something like this:
compile -library=libextras.a DRIVER.c
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates
--
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