From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9043 invoked by alias); 19 Jul 2005 01:15:00 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 9008 invoked by uid 22791); 19 Jul 2005 01:14:55 -0000 Received: from 61-222-84-252.hinet-ip.hinet.net (HELO netsmtp03.unimis.com) (61.222.84.252) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 19 Jul 2005 01:14:55 +0000 Received: from netweb05.net.unimis ([10.50.1.22]) by netsmtp03.unimis.com with Microsoft SMTPSVC(5.0.2195.5329); Tue, 19 Jul 2005 09:14:52 +0800 Received: from LocalHost ([218.2.150.58]) by netweb05.net.unimis with Microsoft SMTPSVC(6.0.3790.1830); Tue, 19 Jul 2005 09:14:51 +0800 Date: Tue, 19 Jul 2005 01:15:00 -0000 From: "Tianjun - zdk" To: "ecos-discuss@sources.redhat.com" , "Andrew Lunn" Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit Message-ID: Subject: Re: Re: [ECOS] how to build a driver to a single library X-SW-Source: 2005-07/txt/msg00172.txt.bz2 Hi, Andrew Lunn i have understood you very correctly. but i also have a doubt: what this `ebsa285_serial_io = ebsa285_serial_io;'means? why can i do that ?and they have the same name . Sincerely yours, Tian-Jun ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >On Mon, Jul 18, 2005 at 04:19:06PM +0800, ZDC 0616 tianjun wrote: >> hi, all >> >> how to build a driver to a single library ,and can link it as : ecos + driver + app ? >> and now i have built it in the ecos library ,i want to then separate . > >Just so i understand you correctly: > >You have written a device driver which is currently part of the eCos >tree. You now want to seperate it from the eCos tree into a library of >its own. You then want to link this library with your application. > >OK. Nothing impossible here, but there is one thing to be careful of. > >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. > > 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 > -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss