This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Linking problems in adding QUICCII ethernet driver
- To: "N.Suresh" <nsuresh at cdotb dot ernet dot in>
- Subject: Re: [ECOS] Linking problems in adding QUICCII ethernet driver
- From: Gary Thomas <gthomas at redhat dot com>
- Date: 09 Oct 2001 14:35:55 +0900
- Cc: eCos Discussion <ecos-discuss at sources dot redhat dot com>
- References: <3BC282CA.9080101@cdotb.ernet.in>
On Tue, 2001-10-09 at 13:53, N.Suresh wrote:
> Hi,
> I was able to compile my QUICCII net ethernet drivers package.
> It has been put into libextras.a.
>
> But when i try to compile the application, it is giving
> following error.
>
> <cut>
>
> powerpc-eabi-gcc -msoft-float -mcpu=860 -Wall -Wpointer-arith
> -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g
> -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions
> -fvtable-gc -finit-priority -Wp,-MD,clock.tmp -c -o hello.o -g -D__ECOS
> -Wall -I/export/home1/nsuresh/ecos-1.3.1/ecos-pqii-net1/install/include
> -ffunction-sections -fdata-sections hello.c
> hello.c:10: warning: function declaration isn't a prototype
>
> powerpc-eabi-gcc -msoft-float -mcpu=860 -Wall -Wpointer-arith
> -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g
> -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions
> -fvtable-gc -finit-priority -Wp,-MD,clock.tmp -nostartfiles -Xlinker
> -Map -Xlinker thread.map
> -L/export/home1/nsuresh/ecos-1.3.1/ecos-pqii-net1/install/lib
> -Wl,--gc-sections --whole-archive -o hello hello.o
> -T/export/home1/nsuresh/ecos-1.3.1/ecos-pqii-net1/install/lib/target.ld
> -nostdlib
>
> /export/home1/nsuresh/ecos-1.3.1/ecos-pqii-net1/install/lib/extras.o: In
> function `quiccii_hl_eth_int':
> /export/home1/nsuresh/work/Hard_Lib/ecos/packages/net/drivers/eth/quiccII/v1_0b1/src/if_hl_interface.cxx:371:
> undefined reference to `net_memcpy(void *, void *, int)'
>
> collect2: ld returned 1 exit status
> make: *** [hello] Error 1
> </cut>
>
> Basically all the reference to the outside (libtarget.a) is failing.
> My driver is in c++.
> is it a problem ? or any idea what's the error.
>
> bye
> thanx in advance
The problem is that we don't [necessarily] support writing drivers in
C++. The linkage for "net_memcpy" is not being set up properly.
You should be able to fix it by making these patches (untested).
If they work, let me know and I'll add them to the sources.
BTW - is there some reason you've written this driver in C++?
================== patch - cut here ===============================
Index: net/tcpip/current/include/machine/ansi.h
===================================================================
RCS file: /home/cvs/ecc/ecc/net/tcpip/current/include/machine/ansi.h,v
retrieving revision 1.3
diff -u -5 -p -r1.3 ansi.h
--- net/tcpip/current/include/machine/ansi.h 1 Mar 2000 16:38:04 -0000 1.3
+++ net/tcpip/current/include/machine/ansi.h 9 Oct 2001 05:33:02 -0000
@@ -56,12 +56,12 @@
#define _MACHINE_ANSI_H_
// Mappings of BSD-style functions used in networking code to those provided
// by the eCos environment.
-void net_memcpy(void *d, void *s, int n);
-void net_memset(void *s, int v, int n);
+externC void net_memcpy(void *d, void *s, int n);
+externC void net_memset(void *s, int v, int n);
#define bcopy(s,d,n) net_memcpy(d,s,n)
#define bzero(s,n) net_memset(s,0,n)
#endif // _MACHINE_ANSI_H_
Index: net/tcpip/current/src/ecos/support.c
===================================================================
RCS file: /home/cvs/ecc/ecc/net/tcpip/current/src/ecos/support.c,v
retrieving revision 1.26
diff -u -5 -p -r1.26 support.c
--- net/tcpip/current/src/ecos/support.c 13 Jun 2001 20:24:41 -0000 1.26
+++ net/tcpip/current/src/ecos/support.c 9 Oct 2001 05:33:53 -0000
@@ -362,19 +362,19 @@ cyg_cltom(u_long x)
struct mbuf *res;
res = (struct mbuf *)((caddr_t)((u_long)mbutl + ((u_long)(x) << MCLSHIFT)));
return res;
}
-void
+externC void
net_memcpy(void *d, void *s, int n)
{
START_STATS();
memcpy(d, s, n);
FINISH_STATS(stats_memcpy);
}
-void
+externC void
net_memset(void *s, int v, int n)
{
START_STATS();
memset(s, v, n);
FINISH_STATS(stats_memset);