LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices

Reply
 
Search this Thread
Old 05-01-2008, 08:17 AM   #1
EmbeddedSteve
LQ Newbie
 
Registered: Sep 2006
Posts: 15

Rep: Reputation: 0
I2C Header File Causing Compile Issue


Greetings All!
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,
from /usr/include/linux/sched.h:11,
from /usr/include/linux/module.h:10,
from /usr/include/linux/i2c.h:31,
from include/UTSLib_include.h:43,
from platformHdw.c:28:
/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,
from /usr/include/linux/module.h:10,
from /usr/include/linux/i2c.h:31,
from include/UTSLib_include.h:43,
from platformHdw.c:28:
/usr/include/linux/timex.h:147: error: field `time' has incomplete type
In file included from /usr/include/asm/div64.h:3,
from /usr/include/linux/jiffies.h:9,
from /usr/include/linux/sched.h:12,
from /usr/include/linux/module.h:10,
from /usr/include/linux/i2c.h:31,
from include/UTSLib_include.h:43,
from platformHdw.c:28:
/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.

Regards,
Stephen
 
Old 05-01-2008, 06:20 PM   #2
PatM
LQ Newbie
 
Registered: Mar 2008
Posts: 27

Rep: Reputation: 15
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.

Quote:
Originally Posted by EmbeddedSteve View Post
Greetings All!

/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 t
Regards,
Stephen
 
Old 05-02-2008, 01:46 AM   #3
aus9
Guru
 
Registered: Oct 2003
Posts: 5,056

Rep: Reputation: Disabled
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
http://tali.admingilde.org/linux-doc...get/index.html
 
Old 05-02-2008, 01:54 AM   #4
aus9
Guru
 
Registered: Oct 2003
Posts: 5,056

Rep: Reputation: Disabled
if that excites you consider then
http://www.linuxdevices.com/ which has a forum for linux users

and the pathway of the kernel

http://209.85.173.104/linux?q=cache:...lnk&cd=1&gl=au

you can google this and d/load as a pdf if it fits your interests
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I2C Header problem with Kernel 2.6 EmbeddedSteve Linux - General 0 06-21-2007 09:56 AM
kernel issue causing nVidia problem? mmaleck Linux - Newbie 1 03-16-2007 12:36 PM
Custom kernel causing odd issue mdkusr Slackware 14 11-20-2006 07:07 PM
I can't compile neither i2c neither lm-sensors Ragnarol Linux - Software 1 04-29-2004 06:00 PM
How to compile a C program in Glade which is included the <pcap.h> header file. swaviswa Programming 0 03-21-2004 07:47 AM


All times are GMT -5. The time now is 09:28 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration