* i2c-dev cross-compile error
@ 2008-01-02 16:35 Roberto Marino
[not found] ` <1199291705.8789.9.camel-KVB57GCTUpPyvZzR7rY+dg@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Roberto Marino @ 2008-01-02 16:35 UTC (permalink / raw)
To: i2c-GZX6beZjE8VD60Wz+7aTrA
Hi all,
I've a problem with i2c-dev on arm.
I'm trying to cross-compile i2c-dev example
(Documentation/i2c/dev-interface) for arm passing these arguments to
cross-compiler
arm-linux-gcc-3.4.1 -I/usr/local/arm/3.4.1/arm-linux/include -O2
prova_max1363.c -o prova_max1363
The error is this (too long to paste completely):
-------------------------
In file included
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/sched.h:12,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/module.h:10,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/i2c.h:31,
from prova_max1363.c:1:
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/jiffies.h:16: error: parse error before "jiffies_64"
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/jiffies.h:20: error: parse error before "get_jiffies_64"
In file included
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/sched.h:18,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/module.h:10,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/i2c.h:31,
from prova_max1363.c:1:
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/semaphore.h:18: error: parse error before "wait_queue_head_t"
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/semaphore.h: In function `sema_init':
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/semaphore.h:46: error: dereferencing pointer to incomplete type
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/semaphore.h:47: error: dereferencing pointer to incomplete type
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/semaphore.h:48: error: dereferencing pointer to incomplete type
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/semaphore.h: In function `sema_count':
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/semaphore.h:66: error: dereferencing pointer to incomplete type
In file included
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/signal.h:4,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/sched.h:25,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/module.h:10,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/i2c.h:31,
from prova_max1363.c:1:
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/list.h:682:2: warning: #warning "don't include kernel headers in userspace"
In file included
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/siginfo.h:4,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/signal.h:7,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/sched.h:25,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/module.h:10,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/i2c.h:31,
from prova_max1363.c:1:
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm-generic/siginfo.h: At top level:
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm-generic/siginfo.h:58: error: size of array `_pad' is too large
In file included
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/sched.h:29,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/module.h:10,
from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/i2c.h:31,
from prova_max1363.c:1:
-----------------------------
This is the source, any idea? :
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define I2C_SLAVE 0x0703 /* Change slave address */
int main(void)
{
int file;
int adapter_nr = 0;
char filename[20];
int addr = 0x34;
char command[3];
char buf[3];
sprintf(filename,"/dev/i2c-%d", adapter_nr);
if ((file = open(filename,O_RDWR)) < 0) {
printf("Open error\n");
/* ERROR HANDLING; you can check errno to see what went
wrong */
exit(1);
}
if (ioctl(file,I2C_SLAVE,addr) < 0) {
printf("ioctl error");
/* ERROR HANDLING; you can check errno to see what went
wrong */
exit(1);
}
command[0] = addr;
buf[1] = 0x61;
buf[2] = 0xd0;
if ( write(file,buf,3) != 3) {
printf("Write error");
}
/* Using I2C Read, equivalent of i2c_smbus_read_byte(file) */
if (read(file,buf,2) != 2) {
/* ERROR HANDLING: i2c transaction failed */
} else {
/* buf[0] contains the read byte */
printf("%c, %c", buf[0],buf[1]);
}
return 0;
}
--
(o_ Roberto (aka formica) Marino
//\ Computer Engineering Student
V_/_ Free Software User - Me|Lug Member
keyID = 641AE37D on pgp.mit.edu
Per favore non mandatemi allegati in Word o PowerPoint.
Si veda http://www.gnu.org/philosophy/no-word-attachments.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: i2c-dev cross-compile error
[not found] ` <1199291705.8789.9.camel-KVB57GCTUpPyvZzR7rY+dg@public.gmane.org>
@ 2008-01-03 9:33 ` Jean Delvare
0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2008-01-03 9:33 UTC (permalink / raw)
To: formica-YbGCGrJzjEK4SyVuDWiTng; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA
Hi Roberto,
Le 2/1/2008, Roberto Marino a écrit:
>I've a problem with i2c-dev on arm.
>I'm trying to cross-compile i2c-dev example
>(Documentation/i2c/dev-interface) for arm passing these arguments to
>cross-compiler
>
>arm-linux-gcc-3.4.1 -I/usr/local/arm/3.4.1/arm-linux/include -O2
>prova_max1363.c -o prova_max1363
>
>The error is this (too long to paste completely):
>(...)
>-----------------------------
>
>This is the source, any idea? :
>
>#include <linux/i2c.h>
>#include <linux/i2c-dev.h>
You are not supposed to include i2c.h from user-space. You should only
include i2c-dev.h, and this should be the one that is shipped in the
i2c-tools [1] package, NOT the one in the kernel tree.
I know that this is error-prone (although it _is_ explained in the
document you mentioned) and that's one thing I intend to fix in the
course of year 2008.
[1] http://www.lm-sensors.org/wiki/I2CTools
>#include <stdio.h>
>#include <stdlib.h>
>#include <sys/types.h>
>#include <sys/stat.h>
>#include <fcntl.h>
>(...)
--
Jean Delvare
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-03 9:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-02 16:35 i2c-dev cross-compile error Roberto Marino
[not found] ` <1199291705.8789.9.camel-KVB57GCTUpPyvZzR7rY+dg@public.gmane.org>
2008-01-03 9:33 ` Jean Delvare
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox