Gentoo Archives: gentoo-ppc-dev

From: felix <felixs@×××××.fr>
To: gentooppc-dev@g.o
Subject: [gentooppc-dev] Cross Compilation Problem !!!
Date: Wed, 03 Jul 2002 03:11:01
Message-Id: 20020703081059.02EB549BEE@mail.esiee.fr
I devellop a system based on PPC405 architecture and I have a cross
compilation problem.
I am a novice in programmation and I cant resolve a library problem (
I think ).

I compiled a kernel with a cross compiler and now I want compil a
program to write on a ISA bus.


When I compile my program, the cross-compiler doesnt found the
fonction "readb" on my libraries.
 I think I find the good library but when I add the directory , the
result is the same.

My cross-compiler name is "p405-gcc", the error message is :

>[mip405@archi2 isa1]$ p405-gcc -o testisa -s sebisa.c >sebisa.c: In function `main': >sebisa.c:57: warning: return type of `main' is not `int' >/home/mip405/tmp/ccwoA8Pi.o: In function `main': >/home/mip405/tmp/ccwoA8Pi.o(.text+0x1c): undefined reference to
`readb'
>/home/mip405/tmp/ccwoA8Pi.o(.text+0x1c): relocation truncated to fit:
R_PPC_REL24 readb
>collect2: ld returned 1 exit status >[mip405@archi2 isa1]$
I doesnt know if my problem is really a library problem but I cant continue the devellopement. The program " sebisa.c " is :
>#include <asm/page.h> >#include <linux/ioport.h> >#include <asm/io.h> >#include <stdio.h> >#include <stdlib.h> >#include <string.h> >#include <unistd.h> >#include <sys/mman.h> >#include <sys/types.h> >#include <sys/stat.h> >#include <fcntl.h> >#include <errno.h> >#include <asm/ibm4xx.h> > > >#define isa_mem_base 0xe0000000 >#define isa_readb(a) readb((a)+isa_mem_base) >#define isa_readw(a) readw((a)+isa_mem_base) >#define isa_writeb(b,a) writeb(b,(a)+isa_mem_base) >#define isa_writew(b,a) writew(b,(a)+isa_mem_base) >#define isa_memcpy_fromio(a,b,c)
memcpy_fromio((a)+isa_mem_base,b,c)
>#define isa_memcpy_toio(a,b,c)
memcpy_toio(a,(b)+isa_mem_base,c)
> >void main() >{ > unsigned long j; /* compteur de tempo */ > unsigned short isa; > > isa =isa_readb( 0xD4000 ); > > for (j=0;j<10000;j+=1) { > printf("==> %08lx fois = 0x%08lx\n", j , isa); > } >}
For your information, the function "ioremap" doesnt work too. Thank you for the caused disturbance but I am really wedged. Sébastien FELIX sebfelix@×××××××.fr "sebisa.c" 68L, 1874C