I2C Header File Causing Compile Issue
This is an update to a previous post from 6/21/07 to which I received no reply. Can anyone Please help!!???
I'm having a serious compile problem I'm hoping somebody can help me with. Documentation and especially examples seem to be non-existent for this issue.
I have a shared object library which implements certain "board support" functions (i.e. accessing devices on our target systems), including I2C. In our currently deployed environment (Based upon Linux 2.4.21 kernel), all is well.
Now, we are looking to transition to the world of Linux 2.6 and we are running into the following problem. It seems that one needs to remove references to most "standard" header files (like stdio.h, etc). However, when I get to the file that implements the I2C driver, I run into problems. IF I don't include <linux/i2c.h>, I get the following:
platformHdw.c:2127: error: storage size of 'msg' isn't known
platformHdw.c:2152: error: `I2C_M_RD' undeclared (first use in this function)
platformHdw.c:2152: error: (Each undeclared identifier is reported only once
platformHdw.c:2152: error: for each function it appears in.)
platformHdw.c:2156: error: `I2C_RDWR' undeclared (first use in this function)
platformHdw.c:2127: warning: unused variable `msg'
As would be expected, since most of this is in the i2c.h file. Now, if I now INCLUDE this in header file, I get the following:
In file included from /usr/include/linux/timex.h:58,
/usr/include/linux/time.h:12: error: redefinition of `struct timespec'
/usr/include/linux/time.h:20: error: parse error before "suseconds_t"
/usr/include/linux/time.h:140: error: redefinition of `struct itimerspec'
/usr/include/linux/time.h:146: error: field `it_interval' has incomplete type
/usr/include/linux/time.h:147: error: field `it_value' has incomplete type
In file included from /usr/include/linux/sched.h:11,
/usr/include/linux/timex.h:147: error: field `time' has incomplete type
In file included from /usr/include/asm/div64.h:3,
/usr/include/asm-generic/div64.h:54:3: #error do_div() does not yet support the C64
And a whole lot more of these type of errors of a similar nature. I understand that a great many things have been moved around, etc, but I am at a loss to find either documentation or examples the would help me overcome this issue.
Can anyone provide any assistance here? I'm really at my wits end here. The cross-compiler or the "native" compiler on the target (for PPC architecture, specifically a PPC440) produce the same results.
Thank you in Advance for your assistance.
I'm no expert (only been at this a month) but it's possible you're using a newer compiler.
The redefinition error means that you have the same structure declared twice. Probably once in your board specific .h file and another in the more general processor support .h file. It might be that the first declaration compiled was correct and the second was wrong.
If you're applying patches from the net then try to track down the original kernel version they were for. 2.4.x patches usually just bork up 2.6.x Even patches from 2.6.18 can break 2.6.24 if they patch things which were changed between 2.6.18 and 2.6.24.
One of the things that really irk me (though I won't blame anyone since this is almost all volunteer time) is the habit of programmers to modify patches to keep up with the -rcX (or even worse, svn/git source) versions without saving a set of patches for the official "stable" releases. Time and time again I've found what appeared to be the perfect patch only to find that the maintainer had moved on and you simply couldn't get the kernel version the patches were made against. As I said, I don't want to call down the programmers. This is all free time and a lot of work, it'd just be nice if they would "freeze" a patch set seperately from the git patches.
and I am even less of a kernel expert but have compiled a few desktop varieties. So offer the following comments.
embedded....my vanilla /Documentation folder search gives about 40 hits with subjects
including powerpc and gadget....from /Documentation/DocBook/gadget.tmpl
This document presents a Linux-USB "Gadget" kernel mode API, for use within peripherals and other USB devices that embed Linux..cull....Gadget drivers can be written so they're easy to port to new hardware....cull...the drivers inside the peripherals are "USB gadget drivers".....
If this interests you here is one link
if that excites you consider then
http://www.linuxdevices.com/ which has a forum for linux users
and the pathway of the kernel
you can google this and d/load as a pdf if it fits your interests
|All times are GMT -5. The time now is 01:19 AM.|