This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: device driver enquirey


On Mon, Dec 18, 2006 at 12:38:33AM +1000, Yi Tang wrote:
> Hi,
> 
> I still don't understand the routine for ecos to find the specific I/O 
> functions simply using handlers and cyg_io_xxx functions.
> 
> Some examples use the cyg_io_lookup fuctions to pass the device info to 
> "handle", like this:
>    err = cyg_io_lookup( "/dev/serial", &handle );
> 
> but where the device info of this lookup function comes from. Through the 
> definition of DEVTAB_ENTRY?
> 
> Following is my test driver for a gpio, I use cyg_io_lookup function to get 
> the correct "handle", but Cyg_ErrNo returns -2, no entitiy found. Hope you 
> can instruct me if anything wrong in my code.

Do you have this as a package inside the eCos build tree?

If so, you need to specify that the gpio.o object file is placed into
libextra.a. In your CDL file you need something like:

compile         -library=libextras.a gpio.c

The problem is that none of the functions in gpio.c are referenced by
name. So the linker thinks they are not needed and throws them
away. Object files in libextra the linker is not allowed to throw
away.

You can see what symbols are in your executable with eg:

arm-elf-nm test

where test is the elf executable. Change arm- to what ever, eg ppc-,
mips-, ...

        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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]