udp/lwip on xilinx

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

udp/lwip on xilinx

Haori Yang
Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}

_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE: udp/lwip on xilinx

Pisano, Edward A

Hello,

I just glanced at the code, but noticed that your remote_pcb is not bound to a local endpoint.  I believe both ends must be grounded with an endpoint.  Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address and port number, but isn’t bound to a local IP Address and port number.

 

 

// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 

Regards,

Ed

 


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:lwip-users-bounces+edward.pisano=[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

 

Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: udp/lwip on xilinx

Haori Yang
Thanks for pointing out.

I am quite confused about this. You mean the two ends of a pcb have to be bound to a ip/port pair?

Thanks. I'll try that.

On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

Hello,

I just glanced at the code, but noticed that your remote_pcb is not bound to a local endpoint.  I believe both ends must be grounded with an endpoint.  Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address and port number, but isn't bound to a local IP Address and port number.

 

 

// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 

Regards,

Ed

 


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

 

Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}


_______________________________________________
lwip-users mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: udp/lwip on xilinx

Haori Yang
In reply to this post by Pisano, Edward A
Hi, Ed

  do you happen to know why am I getting a lot of undefined reference?

  like this?  I am using EDK 8.1i

  At Local date and time: Wed Oct 04 21:49:35 2006
 xbash -q -c "cd /cygdrive/e/Temp/MicroDemo/WebClient2/; /usr/bin/make -f system.make WebClient_program; exit;" started...
mb-gcc -O2 Send2PC/send.c  -o WebClient/executable.elf \
    -mno-xl-soft-mul     -Wl,-T -Wl,TestApp_Peripheral/src/TestApp_Peripheral_LinkScr.ld  -g    -I./microblaze_0/include/  -L./microblaze_0/lib/  \
 

Send2PC/send.c:79:2: warning: no newline at end of file

/cygdrive/c/DOCUME~1/Haori/LOCALS~1/Temp/ccH5S4ia.o: In function `main':
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:30: undefined reference to `mem_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:35: undefined reference to `memp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:36: undefined reference to `pbuf_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:39: undefined reference to `xemacif_setmac'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:44: undefined reference to `netif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:46: undefined reference to `udp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:48: undefined reference to `mem_malloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:50: undefined reference to `XEmacIf_ConfigTable'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `xemacif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `ip_input'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `netif_add'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `netif_set_default'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `udp_new'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:64: undefined reference to `udp_connect'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:68: undefined reference to `pbuf_alloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:74: undefined reference to `udp_send'
collect2: ld returned 1 exit status
make: *** [WebClient/executable.elf] Error 1

Done!

On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

Hello,

I just glanced at the code, but noticed that your remote_pcb is not bound to a local endpoint.  I believe both ends must be grounded with an endpoint.  Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address and port number, but isn't bound to a local IP Address and port number.

 

 

// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 

Regards,

Ed

 


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

 

Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}


_______________________________________________
lwip-users mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE: udp/lwip on xilinx

Pisano, Edward A
In reply to this post by Haori Yang

Yes.  A UDP Session is defined by the IP Addresses and Port Numbers of the endpoints.  The struct udp_pcb contains members for both the the local and destination endpoints.  If you look at the UDP Header structure and the IP Header structure, you’ll see that they include both the source and destination IP Addresses and Port Numbers.   Other protocols, such as ARP, use both the local and remote endpoint information to resolve the MAC Addresses.

 

I’m not sure if that is the cause of your ‘undefined reference”, but I didn’t see anything else in your code that jumped out at me.

 

Regards,

Ed


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:lwip-users-bounces+edward.pisano=[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:45 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx

 

Thanks for pointing out.

I am quite confused about this. You mean the two ends of a pcb have to be bound to a ip/port pair?

Thanks. I'll try that.

On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

Hello,

I just glanced at the code, but noticed that your remote_pcb is not bound to a local endpoint.  I believe both ends must be grounded with an endpoint.  Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address and port number, but isn't bound to a local IP Address and port number.

 

 

// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 

Regards,

Ed

 


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

 

Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE: udp/lwip on xilinx

Pisano, Edward A
In reply to this post by Haori Yang

All of your “undefined reference” errors are to functions in the lwIP library, but I don’t see the lwIP4lib called out on your ‘make’ line.  The –L identifies the correct path to the directory containing the library, but you need to add the “-llwip4” to your make line.  If you’re working in the XiLinx Platform Studio, right-click on “Compiler Options”, go to the “Paths and Options” tab and specify ‘lwip4’ in the “Libraries to Link against” field.

 

Regards,

Ed


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:lwip-users-bounces+edward.pisano=[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:52 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx

 

Hi, Ed

  do you happen to know why am I getting a lot of undefined reference?

  like this?  I am using EDK 8.1i

  At Local date and time: Wed Oct 04 21:49:35 2006
 xbash -q -c "cd /cygdrive/e/Temp/MicroDemo/WebClient2/; /usr/bin/make -f system.make WebClient_program; exit;" started...
mb-gcc -O2 Send2PC/send.c  -o WebClient/executable.elf \
    -mno-xl-soft-mul     -Wl,-T -Wl,TestApp_Peripheral/src/TestApp_Peripheral_LinkScr.ld  -g    -I./microblaze_0/include/  -L./microblaze_0/lib/  \
 

Send2PC/send.c:79:2: warning: no newline at end of file

/cygdrive/c/DOCUME~1/Haori/LOCALS~1/Temp/ccH5S4ia.o: In function `main':
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:30: undefined reference to `mem_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:35: undefined reference to `memp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:36: undefined reference to `pbuf_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:39: undefined reference to `xemacif_setmac'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:44: undefined reference to `netif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:46: undefined reference to `udp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:48: undefined reference to `mem_malloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:50: undefined reference to `XEmacIf_ConfigTable'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `xemacif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `ip_input'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `netif_add'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `netif_set_default'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `udp_new'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:64: undefined reference to `udp_connect'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:68: undefined reference to `pbuf_alloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:74: undefined reference to `udp_send'
collect2: ld returned 1 exit status
make: *** [WebClient/executable.elf] Error 1

Done!

On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

Hello,

I just glanced at the code, but noticed that your remote_pcb is not bound to a local endpoint.  I believe both ends must be grounded with an endpoint.  Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address and port number, but isn't bound to a local IP Address and port number.

 

 

// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 

Regards,

Ed

 


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

 

Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: udp/lwip on xilinx

Haori Yang
In reply to this post by Pisano, Edward A
Thanks a lot, Ed.

I figured the 'undefined reference' is caused by the setting of my compiler.

unfortunately, the design just refuses to work.

I've finish a design using xilnet, which didn't work. I switch to lwip today, still the same result. kind of frustrated.

the led on the RJ45 connector, never comes on.


anyway, I appreciate your help. have a wonderful evening.

Haori

On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

Yes.  A UDP Session is defined by the IP Addresses and Port Numbers of the endpoints.  The struct udp_pcb contains members for both the the local and destination endpoints.  If you look at the UDP Header structure and the IP Header structure, you'll see that they include both the source and destination IP Addresses and Port Numbers.   Other protocols, such as ARP, use both the local and remote endpoint information to resolve the MAC Addresses.

 

I'm not sure if that is the cause of your 'undefined reference", but I didn't see anything else in your code that jumped out at me.

 

Regards,

Ed


From: lwip-users-bounces+edward.pisano= [hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:45 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx

 

Thanks for pointing out.

I am quite confused about this. You mean the two ends of a pcb have to be bound to a ip/port pair?

Thanks. I'll try that.

On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

Hello,

I just glanced at the code, but noticed that your remote_pcb is not bound to a local endpoint.  I believe both ends must be grounded with an endpoint.  Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address and port number, but isn't bound to a local IP Address and port number.

 

 

// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 

Regards,

Ed

 


From: lwip-users-bounces+edward.pisano= [hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

 

Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}


_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: udp/lwip on xilinx

Haori Yang
In reply to this post by Pisano, Edward A
You are absolutely right about this! , you are good... I found this error. the code can be compiled all right.

But the whole design just doesn't work.

I was checking the mail archive, I saw that you've done this kind of stuff before. could you give me some hint what could possiblely went wrong? My setup:  AvNet Virtex4LX25 Evaluation board + Xilinx EDK 8.1i. I connected my desktop and the board with a crossover cable.

I used BSB create a project. then, go to software platform setting, select lwip. set the 'emac_instances' of the lwip.
Generate netlist, Generate library. create a new project, import the code I post. compile the project (set as 'initialize bram'). update bit file, download bit file to fpga. the 'done' comes on.

but my desktop always shows that 'network connection' is unplugged... and the led on the ethernet connector never comes up.

It's so simple that I can't think of anything that might be wrong. it's killing me...

I'll atttach the mhs and mss files.


On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

All of your "undefined reference" errors are to functions in the lwIP library, but I don't see the lwIP4lib called out on your 'make' line.  The –L identifies the correct path to the directory containing the library, but you need to add the "-llwip4" to your make line.  If you're working in the XiLinx Platform Studio, right-click on "Compiler Options", go to the "Paths and Options" tab and specify 'lwip4' in the "Libraries to Link against" field.

 

Regards,

Ed


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:52 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx

 

Hi, Ed

  do you happen to know why am I getting a lot of undefined reference?

  like this?  I am using EDK 8.1i

  At Local date and time: Wed Oct 04 21:49:35 2006
 xbash -q -c "cd /cygdrive/e/Temp/MicroDemo/WebClient2/; /usr/bin/make -f system.make WebClient_program; exit;" started...
mb-gcc -O2 Send2PC/send.c  -o WebClient/executable.elf \
    -mno-xl-soft-mul     -Wl,-T -Wl,TestApp_Peripheral/src/TestApp_Peripheral_LinkScr.ld  -g    -I./microblaze_0/include/  -L./microblaze_0/lib/  \
 

Send2PC/send.c:79:2: warning: no newline at end of file

/cygdrive/c/DOCUME~1/Haori/LOCALS~1/Temp/ccH5S4ia.o: In function `main':
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:30: undefined reference to `mem_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:35: undefined reference to `memp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:36: undefined reference to `pbuf_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:39: undefined reference to `xemacif_setmac'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:44: undefined reference to `netif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:46: undefined reference to `udp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:48: undefined reference to `mem_malloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:50: undefined reference to `XEmacIf_ConfigTable'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `xemacif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `ip_input'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `netif_add'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `netif_set_default'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `udp_new'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:64: undefined reference to `udp_connect'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:68: undefined reference to `pbuf_alloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:74: undefined reference to `udp_send'
collect2: ld returned 1 exit status
make: *** [WebClient/executable.elf] Error 1

Done!

On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

Hello,

I just glanced at the code, but noticed that your remote_pcb is not bound to a local endpoint.  I believe both ends must be grounded with an endpoint.  Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address and port number, but isn't bound to a local IP Address and port number.

 

 

// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 

Regards,

Ed

 


From: lwip-users-bounces+edward.pisano= [hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

 

Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}


_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users

system.mhs (12K) Download Attachment
system.mss (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: udp/lwip on xilinx

Sathya Thammanur
Hi Haori,
You need to ensure that the hardware is working first. Can you check if the TestApp_Peripheral example that is created as part of BSB works without any issues? If not then the hardware has issues. If it does work, then you try to see if you are getting interrupts with Emac or not. You can enable the debug option for lwip library in XPS and see if your hyper terminal does print out all the debug messages when you try to ping th eboard.

Sathya


On 10/4/06, Haori Yang <[hidden email]> wrote:
You are absolutely right about this! , you are good... I found this error. the code can be compiled all right.

But the whole design just doesn't work.

I was checking the mail archive, I saw that you've done this kind of stuff before. could you give me some hint what could possiblely went wrong? My setup:  AvNet Virtex4LX25 Evaluation board + Xilinx EDK 8.1i. I connected my desktop and the board with a crossover cable.

I used BSB create a project. then, go to software platform setting, select lwip. set the 'emac_instances' of the lwip.
Generate netlist, Generate library. create a new project, import the code I post. compile the project (set as 'initialize bram'). update bit file, download bit file to fpga. the 'done' comes on.

but my desktop always shows that 'network connection' is unplugged... and the led on the ethernet connector never comes up.

It's so simple that I can't think of anything that might be wrong. it's killing me...

I'll atttach the mhs and mss files.



On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

All of your "undefined reference" errors are to functions in the lwIP library, but I don't see the lwIP4lib called out on your 'make' line.  The –L identifies the correct path to the directory containing the library, but you need to add the "-llwip4" to your make line.  If you're working in the XiLinx Platform Studio, right-click on "Compiler Options", go to the "Paths and Options" tab and specify 'lwip4' in the "Libraries to Link against" field.

 

Regards,

Ed


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:52 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx

 

Hi, Ed

  do you happen to know why am I getting a lot of undefined reference?

  like this?  I am using EDK 8.1i

  At Local date and time: Wed Oct 04 21:49:35 2006
 xbash -q -c "cd /cygdrive/e/Temp/MicroDemo/WebClient2/; /usr/bin/make -f system.make WebClient_program; exit;" started...
mb-gcc -O2 Send2PC/send.c  -o WebClient/executable.elf \
    -mno-xl-soft-mul     -Wl,-T -Wl,TestApp_Peripheral/src/TestApp_Peripheral_LinkScr.ld  -g    -I./microblaze_0/include/  -L./microblaze_0/lib/  \
 

Send2PC/send.c:79:2: warning: no newline at end of file

/cygdrive/c/DOCUME~1/Haori/LOCALS~1/Temp/ccH5S4ia.o: In function `main':
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:30: undefined reference to `mem_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:35: undefined reference to `memp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:36: undefined reference to `pbuf_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:39: undefined reference to `xemacif_setmac'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:44: undefined reference to `netif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:46: undefined reference to `udp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:48: undefined reference to `mem_malloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:50: undefined reference to `XEmacIf_ConfigTable'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `xemacif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `ip_input'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `netif_add'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `netif_set_default'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `udp_new'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:64: undefined reference to `udp_connect'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:68: undefined reference to `pbuf_alloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:74: undefined reference to `udp_send'
collect2: ld returned 1 exit status
make: *** [WebClient/executable.elf] Error 1

Done!

On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

Hello,

I just glanced at the code, but noticed that your remote_pcb is not bound to a local endpoint.  I believe both ends must be grounded with an endpoint.  Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address and port number, but isn't bound to a local IP Address and port number.

 

 

// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 

Regards,

Ed

 


From: lwip-users-bounces+edward.pisano= [hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

 

Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}


_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank"> http://lists.nongnu.org/mailman/listinfo/lwip-users




_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: udp/lwip on xilinx

Haori Yang
Hi, Sathya

  Thanks for the suggestion.

  I did take a look at my code use GDB. Yeah, you are right. i should first run the testapp. but the ethernet part is just a loop back, right? that means, problem with PHY won't be reported?

  I tried to output information to the RS232. the code stops on the printf command. and I don't know why. if I want to output information to RS232, I should still enable the RS232 peripheral, and assign opb_uartlite as driver to it, right? just select debug_module(opb_mdm) as the standard input/output of the MicroBlaze?

  sorry about all these questions, guys. I am quite a newbie to this.

  Thanks.

On 10/5/06, Sathya Thammanur <[hidden email]> wrote:
Hi Haori,
You need to ensure that the hardware is working first. Can you check if the TestApp_Peripheral example that is created as part of BSB works without any issues? If not then the hardware has issues. If it does work, then you try to see if you are getting interrupts with Emac or not. You can enable the debug option for lwip library in XPS and see if your hyper terminal does print out all the debug messages when you try to ping th eboard.

Sathya



On 10/4/06, Haori Yang <[hidden email]> wrote:
You are absolutely right about this! , you are good... I found this error. the code can be compiled all right.

But the whole design just doesn't work.

I was checking the mail archive, I saw that you've done this kind of stuff before. could you give me some hint what could possiblely went wrong? My setup:  AvNet Virtex4LX25 Evaluation board + Xilinx EDK 8.1i. I connected my desktop and the board with a crossover cable.

I used BSB create a project. then, go to software platform setting, select lwip. set the 'emac_instances' of the lwip.
Generate netlist, Generate library. create a new project, import the code I post. compile the project (set as 'initialize bram'). update bit file, download bit file to fpga. the 'done' comes on.

but my desktop always shows that 'network connection' is unplugged... and the led on the ethernet connector never comes up.

It's so simple that I can't think of anything that might be wrong. it's killing me...

I'll atttach the mhs and mss files.



On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

All of your "undefined reference" errors are to functions in the lwIP library, but I don't see the lwIP4lib called out on your 'make' line.  The –L identifies the correct path to the directory containing the library, but you need to add the "-llwip4" to your make line.  If you're working in the XiLinx Platform Studio, right-click on "Compiler Options", go to the "Paths and Options" tab and specify 'lwip4' in the "Libraries to Link against" field.

 

Regards,

Ed


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:52 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx

 

Hi, Ed

  do you happen to know why am I getting a lot of undefined reference?

  like this?  I am using EDK 8.1i

  At Local date and time: Wed Oct 04 21:49:35 2006
 xbash -q -c "cd /cygdrive/e/Temp/MicroDemo/WebClient2/; /usr/bin/make -f system.make WebClient_program; exit;" started...
mb-gcc -O2 Send2PC/send.c  -o WebClient/executable.elf \
    -mno-xl-soft-mul     -Wl,-T -Wl,TestApp_Peripheral/src/TestApp_Peripheral_LinkScr.ld  -g    -I./microblaze_0/include/  -L./microblaze_0/lib/  \
 

Send2PC/send.c:79:2: warning: no newline at end of file

/cygdrive/c/DOCUME~1/Haori/LOCALS~1/Temp/ccH5S4ia.o: In function `main':
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:30: undefined reference to `mem_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:35: undefined reference to `memp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:36: undefined reference to `pbuf_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:39: undefined reference to `xemacif_setmac'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:44: undefined reference to `netif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:46: undefined reference to `udp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:48: undefined reference to `mem_malloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:50: undefined reference to `XEmacIf_ConfigTable'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `xemacif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `ip_input'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `netif_add'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `netif_set_default'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `udp_new'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:64: undefined reference to `udp_connect'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:68: undefined reference to `pbuf_alloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:74: undefined reference to `udp_send'
collect2: ld returned 1 exit status
make: *** [WebClient/executable.elf] Error 1

Done!

On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

Hello,

I just glanced at the code, but noticed that your remote_pcb is not bound to a local endpoint.  I believe both ends must be grounded with an endpoint.  Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address and port number, but isn't bound to a local IP Address and port number.

 

 

// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 

Regards,

Ed

 


From: lwip-users-bounces+edward.pisano= [hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

 

Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}


_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.nongnu.org/mailman/listinfo/lwip-users




_______________________________________________
lwip-users mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: udp/lwip on xilinx

Haori Yang
In reply to this post by Sathya Thammanur
Hi,
  
   I hooked up the GBD today, and ran the testApp example. it seems that the board works fine. it passed all the test, including the mca test. but the leds on the ethernet connector never were lighted, even I connected the board to the PC with a crossover cable.

  I run my design in the debug mode. I found that there's an error after calling function mem_malloc. in the rs232 terminal, I see that "mem_malloc: can not allocate ** bytes". I changed the size of my memory to smaller size. still no luck. I am not clear about this case. any clue? I implement xilmfs library as well. the board that I have has 16MB sdram. does the error has something to do with the size of the memory avaible? how to configure the hardware?

 the code I have is below. and the mhs mss files are in the attachment.

 any help is appreciated.

Haori

 
#include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"
#include "lwip/netif.h"
#include "stdio.h"

extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[10] = "beet\n";
        unsigned char *buffPtr;

buffPtr = mem_malloc(sizeof(buffer));
memcpy(buffPtr, buffer, sizeof(buffer)); //copy's from buffer to buffer


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 default_netif = mem_malloc(sizeof(struct netif));
 //default_netif = (struct netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                           
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
 udp_bind(remote_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,10,PBUF_RAM);
 p->payload = buffPtr;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}










On 10/5/06, Sathya Thammanur <[hidden email]> wrote:
Hi Haori,
You need to ensure that the hardware is working first. Can you check if the TestApp_Peripheral example that is created as part of BSB works without any issues? If not then the hardware has issues. If it does work, then you try to see if you are getting interrupts with Emac or not. You can enable the debug option for lwip library in XPS and see if your hyper terminal does print out all the debug messages when you try to ping th eboard.

Sathya



On 10/4/06, Haori Yang <[hidden email]> wrote:
You are absolutely right about this! , you are good... I found this error. the code can be compiled all right.

But the whole design just doesn't work.

I was checking the mail archive, I saw that you've done this kind of stuff before. could you give me some hint what could possiblely went wrong? My setup:  AvNet Virtex4LX25 Evaluation board + Xilinx EDK 8.1i. I connected my desktop and the board with a crossover cable.

I used BSB create a project. then, go to software platform setting, select lwip. set the 'emac_instances' of the lwip.
Generate netlist, Generate library. create a new project, import the code I post. compile the project (set as 'initialize bram'). update bit file, download bit file to fpga. the 'done' comes on.

but my desktop always shows that 'network connection' is unplugged... and the led on the ethernet connector never comes up.

It's so simple that I can't think of anything that might be wrong. it's killing me...

I'll atttach the mhs and mss files.



On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

All of your "undefined reference" errors are to functions in the lwIP library, but I don't see the lwIP4lib called out on your 'make' line.  The –L identifies the correct path to the directory containing the library, but you need to add the "-llwip4" to your make line.  If you're working in the XiLinx Platform Studio, right-click on "Compiler Options", go to the "Paths and Options" tab and specify 'lwip4' in the "Libraries to Link against" field.

 

Regards,

Ed


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:52 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx

 

Hi, Ed

  do you happen to know why am I getting a lot of undefined reference?

  like this?  I am using EDK 8.1i

  At Local date and time: Wed Oct 04 21:49:35 2006
 xbash -q -c "cd /cygdrive/e/Temp/MicroDemo/WebClient2/; /usr/bin/make -f system.make WebClient_program; exit;" started...
mb-gcc -O2 Send2PC/send.c  -o WebClient/executable.elf \
    -mno-xl-soft-mul     -Wl,-T -Wl,TestApp_Peripheral/src/TestApp_Peripheral_LinkScr.ld  -g    -I./microblaze_0/include/  -L./microblaze_0/lib/  \
 

Send2PC/send.c:79:2: warning: no newline at end of file

/cygdrive/c/DOCUME~1/Haori/LOCALS~1/Temp/ccH5S4ia.o: In function `main':
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:30: undefined reference to `mem_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:35: undefined reference to `memp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:36: undefined reference to `pbuf_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:39: undefined reference to `xemacif_setmac'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:44: undefined reference to `netif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:46: undefined reference to `udp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:48: undefined reference to `mem_malloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:50: undefined reference to `XEmacIf_ConfigTable'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `xemacif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `ip_input'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `netif_add'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `netif_set_default'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `udp_new'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:64: undefined reference to `udp_connect'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:68: undefined reference to `pbuf_alloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:74: undefined reference to `udp_send'
collect2: ld returned 1 exit status
make: *** [WebClient/executable.elf] Error 1

Done!

On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

Hello,

I just glanced at the code, but noticed that your remote_pcb is not bound to a local endpoint.  I believe both ends must be grounded with an endpoint.  Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address and port number, but isn't bound to a local IP Address and port number.

 

 

// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 

Regards,

Ed

 


From: lwip-users-bounces+edward.pisano= [hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

 

Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}


_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.nongnu.org/mailman/listinfo/lwip-users




_______________________________________________
lwip-users mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: udp/lwip on xilinx

Haori Yang
In reply to this post by Sathya Thammanur
guys,
  
   I capture the output of the hyper terminal. for some reason, the error about "can't allocate ** bytes" just disappeared. I didn't even change the code. I enabled the xilmfs library and set the starting address of the program in the 16Mb sdram the board has.

  the hyper terminal gives out this, before it freezes there. Why the end of the lines was not shown? can you guys tell what's wrong here?

  another question would be when exactly should the led on the ethernet connector be lighten? I connect a PC with a fpga board, using a crossover cable. the leds were never lighten. I assume the connection between these two was not created at all, right?

  thanks,

haori

netif_set_ipaddr: netif address being changed
netif: IP address of interface    set to ...
netif: netmask of interface    set to ...
netif: GW address of interface    set to ...
netif: added interface e0 IP addr ... netmask ... gw ...
netif: setting default interface e0
udp_bind(ipaddr = ..., port = )
udp_bind: bound to ..., port
udp_connect: connected to ..., port
pbuf_alloc(length=)
pbuf_alloc(length=) ==
udp_send
pbuf_header: failed as  <
pbuf_alloc(length=)
pbuf_alloc(length=) ==
pbuf_chain:  references
udp_send: added header pbuf  before given pbuf
udp_send: sending datagram of length
udp_send: UDP packet length
udp_send: UDP checksum 0xB66A
udp_send: ip_output_if (,,,,IP_PROTO_UDP,)
pbuf_header: old  new  (619814488)
ip_output_if: e0
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |          | (v, hl, tos, len)
+-------------------------------+
|          ||       | (id, flags, offset)
+-------------------------------+
|    |    |    0x00FF     | (ttl, proto, chksum)
+-------------------------------+
|  149  |  199  |    6  |  108  | (src)
+-------------------------------+
|  149  |  199  |    6  |  107  | (dest)
+-------------------------------+
netif->output()pbuf_header: old  new  (619814468)
pbuf_take()
pbuf_take: skipping pbuf not of type PBUF_REF
pbuf_take: skipping pbuf not of type PBUF_REF
pbuf_take: end of chain reached.
pbuf_alloc(length=)
pbuf_alloc(length=) ==




 

On 10/5/06, Sathya Thammanur <[hidden email]> wrote:
Hi Haori,
You need to ensure that the hardware is working first. Can you check if the TestApp_Peripheral example that is created as part of BSB works without any issues? If not then the hardware has issues. If it does work, then you try to see if you are getting interrupts with Emac or not. You can enable the debug option for lwip library in XPS and see if your hyper terminal does print out all the debug messages when you try to ping th eboard.

Sathya



On 10/4/06, Haori Yang <[hidden email]> wrote:
You are absolutely right about this! , you are good... I found this error. the code can be compiled all right.

But the whole design just doesn't work.

I was checking the mail archive, I saw that you've done this kind of stuff before. could you give me some hint what could possiblely went wrong? My setup:  AvNet Virtex4LX25 Evaluation board + Xilinx EDK 8.1i. I connected my desktop and the board with a crossover cable.

I used BSB create a project. then, go to software platform setting, select lwip. set the 'emac_instances' of the lwip.
Generate netlist, Generate library. create a new project, import the code I post. compile the project (set as 'initialize bram'). update bit file, download bit file to fpga. the 'done' comes on.

but my desktop always shows that 'network connection' is unplugged... and the led on the ethernet connector never comes up.

It's so simple that I can't think of anything that might be wrong. it's killing me...

I'll atttach the mhs and mss files.



On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

All of your "undefined reference" errors are to functions in the lwIP library, but I don't see the lwIP4lib called out on your 'make' line.  The –L identifies the correct path to the directory containing the library, but you need to add the "-llwip4" to your make line.  If you're working in the XiLinx Platform Studio, right-click on "Compiler Options", go to the "Paths and Options" tab and specify 'lwip4' in the "Libraries to Link against" field.

 

Regards,

Ed


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:52 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx

 

Hi, Ed

  do you happen to know why am I getting a lot of undefined reference?

  like this?  I am using EDK 8.1i

  At Local date and time: Wed Oct 04 21:49:35 2006
 xbash -q -c "cd /cygdrive/e/Temp/MicroDemo/WebClient2/; /usr/bin/make -f system.make WebClient_program; exit;" started...
mb-gcc -O2 Send2PC/send.c  -o WebClient/executable.elf \
    -mno-xl-soft-mul     -Wl,-T -Wl,TestApp_Peripheral/src/TestApp_Peripheral_LinkScr.ld  -g    -I./microblaze_0/include/  -L./microblaze_0/lib/  \
 

Send2PC/send.c:79:2: warning: no newline at end of file

/cygdrive/c/DOCUME~1/Haori/LOCALS~1/Temp/ccH5S4ia.o: In function `main':
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:30: undefined reference to `mem_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:35: undefined reference to `memp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:36: undefined reference to `pbuf_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:39: undefined reference to `xemacif_setmac'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:44: undefined reference to `netif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:46: undefined reference to `udp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:48: undefined reference to `mem_malloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:50: undefined reference to `XEmacIf_ConfigTable'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `xemacif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `ip_input'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `netif_add'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `netif_set_default'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `udp_new'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:64: undefined reference to `udp_connect'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:68: undefined reference to `pbuf_alloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:74: undefined reference to `udp_send'
collect2: ld returned 1 exit status
make: *** [WebClient/executable.elf] Error 1

Done!

On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

Hello,

I just glanced at the code, but noticed that your remote_pcb is not bound to a local endpoint.  I believe both ends must be grounded with an endpoint.  Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address and port number, but isn't bound to a local IP Address and port number.

 

 

// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 

Regards,

Ed

 


From: lwip-users-bounces+edward.pisano= [hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

 

Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}


_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.nongnu.org/mailman/listinfo/lwip-users




_______________________________________________
lwip-users mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE: udp/lwip on xilinx

Matthew Yingling-2
What do you mean by "Why the end of the lines was not shown?"?

I found that changing

contrib\ports\v2pro\include\arch\cc.h

from

#define LWIP_PLATFORM_DIAG(x) do {xil_printf x;} while(0)

to

#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0)

helps make debugging actually useful on the Xilinx platform.  xil_printf
can't handle %p delimiters and requires explicit \r\n pairs instead of
inserting \r with \n, and this makes the LwIP debug output very difficult to
use otherwise.

Matthew

-----Original Message-----
From: lwip-users-bounces+matt=[hidden email]
[mailto:lwip-users-bounces+matt=[hidden email]]On Behalf Of Haori
Yang
Sent: Thursday, October 05, 2006 5:31 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx


guys,

   I capture the output of the hyper terminal. for some reason, the error
about "can't allocate ** bytes" just disappeared. I didn't even change the
code. I enabled the xilmfs library and set the starting address of the
program in the 16Mb sdram the board has.

  the hyper terminal gives out this, before it freezes there. Why the end of
the lines was not shown? can you guys tell what's wrong here?

  another question would be when exactly should the led on the ethernet
connector be lighten? I connect a PC with a fpga board, using a crossover
cable. the leds were never lighten. I assume the connection between these
two was not created at all, right?

  thanks,

haori

netif_set_ipaddr: netif address being changed
netif: IP address of interface    set to ...
netif: netmask of interface    set to ...
netif: GW address of interface    set to ...
netif: added interface e0 IP addr ... netmask ... gw ...
netif: setting default interface e0
udp_bind(ipaddr = ..., port = )
udp_bind: bound to ..., port
udp_connect: connected to ..., port
pbuf_alloc(length=)
pbuf_alloc(length=) ==
udp_send
pbuf_header: failed as  <
pbuf_alloc(length=)
pbuf_alloc(length=) ==
pbuf_chain:  references
udp_send: added header pbuf  before given pbuf
udp_send: sending datagram of length
udp_send: UDP packet length
udp_send: UDP checksum 0xB66A
udp_send: ip_output_if (,,,,IP_PROTO_UDP,)
pbuf_header: old  new  (619814488)
ip_output_if: e0
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |          | (v, hl, tos, len)
+-------------------------------+
|          ||       | (id, flags, offset)
+-------------------------------+
|    |    |    0x00FF     | (ttl, proto, chksum)
+-------------------------------+
|  149  |  199  |    6  |  108  | (src)
+-------------------------------+
|  149  |  199  |    6  |  107  | (dest)
+-------------------------------+
netif->output()pbuf_header: old  new  (619814468)
pbuf_take()
pbuf_take: skipping pbuf not of type PBUF_REF
pbuf_take: skipping pbuf not of type PBUF_REF
pbuf_take: end of chain reached.
pbuf_alloc(length=)
pbuf_alloc(length=) ==







On 10/5/06, Sathya Thammanur <[hidden email]> wrote:
Hi Haori,
You need to ensure that the hardware is working first. Can you check if the
TestApp_Peripheral example that is created as part of BSB works without any
issues? If not then the hardware has issues. If it does work, then you try
to see if you are getting interrupts with Emac or not. You can enable the
debug option for lwip library in XPS and see if your hyper terminal does
print out all the debug messages when you try to ping th eboard.

Sathya




On 10/4/06, Haori Yang <[hidden email] > wrote:
You are absolutely right about this! , you are good... I found this error.
the code can be compiled all right.

But the whole design just doesn't work.

I was checking the mail archive, I saw that you've done this kind of stuff
before. could you give me some hint what could possiblely went wrong? My
setup:  AvNet Virtex4LX25 Evaluation board + Xilinx EDK 8.1i. I connected my
desktop and the board with a crossover cable.

I used BSB create a project. then, go to software platform setting, select
lwip. set the 'emac_instances' of the lwip.
Generate netlist, Generate library. create a new project, import the code I
post. compile the project (set as 'initialize bram'). update bit file,
download bit file to fpga. the 'done' comes on.

but my desktop always shows that 'network connection' is unplugged... and
the led on the ethernet connector never comes up.

It's so simple that I can't think of anything that might be wrong. it's
killing me...

I'll atttach the mhs and mss files.




On 10/4/06, Pisano, Edward A < [hidden email]> wrote:
All of your "undefined reference" errors are to functions in the lwIP
library, but I don't see the lwIP4lib called out on your 'make' line.
 The –L identifies the correct path to the directory containing the library,
but you need to add the "-llwip4" to your make line.  If you're working in
the XiLinx Platform Studio, right-click on "Compiler Options", go to the
"Paths and Options" tab and specify 'lwip4' in the "Libraries to Link
against" field.

Regards,
Ed



From: lwip-users-bounces+edward.pisano=[hidden email]
[mailto:lwip-users-bounces+edward.pisano=[hidden email]] On Behalf Of
Haori Yang
Sent: Wednesday, October 04, 2006 6:52 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx

Hi, Ed

  do you happen to know why am I getting a lot of undefined reference?

  like this?  I am using EDK 8.1i

  At Local date and time: Wed Oct 04 21:49:35 2006
 xbash -q -c "cd /cygdrive/e/Temp/MicroDemo/WebClient2/; /usr/bin/make -f
system.make WebClient_program; exit;" started...
mb-gcc -O2 Send2PC/send.c  -o WebClient/executable.elf \
    -mno-xl-soft-mul     -Wl,-T -Wl,TestApp_Peripheral/src/TestApp_Periphera
l_LinkScr.ld  -g    -I./microblaze_0/include/  -L./microblaze_0/lib/  \


Send2PC/send.c:79:2: warning: no newline at end of file

/cygdrive/c/DOCUME~1/Haori/LOCALS~1/Temp/ccH5S4ia.o: In function `main':
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:30: undefined reference
to `mem_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:35: undefined reference
to `memp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:36: undefined reference
to `pbuf_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:39: undefined reference
to `xemacif_setmac'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:44: undefined reference
to `netif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:46: undefined reference
to `udp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:48: undefined reference
to `mem_malloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:50: undefined reference
to `XEmacIf_ConfigTable'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference
to `xemacif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference
to `ip_input'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference
to `netif_add'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference
to `netif_set_default'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference
to `udp_new'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:64: undefined reference
to `udp_connect'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:68: undefined reference
to `pbuf_alloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:74: undefined reference
to `udp_send'
collect2: ld returned 1 exit status
make: *** [WebClient/executable.elf] Error 1

Done!
On 10/4/06, Pisano, Edward A < [hidden email]> wrote:
Hello,
I just glanced at the code, but noticed that your remote_pcb is not bound to
a local endpoint.  I believe both ends must be grounded with an endpoint.
Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address
and port number, but isn't bound to a local IP Address and port number.


// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

Regards,
Ed




From: lwip-users-bounces+edward.pisano= [hidden email] [mailto:
lwip-users-bounces+edward.pisano=[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

Guys,

   I am trying to implement a udp client on a xilinx fpga. here's my code. I
am getting "undefined reference" errors. could you take a look at it?
Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2],
ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2],
gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);

 netif_set_default(default_netif);


// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;


 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}

_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users





_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users






_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: udp/lwip on xilinx

Haori Yang
I mean the values weren't shown, it shows dots "..." instead

I will try your suggestion right now. thanks!

do you see anything uncommon in my post?

thanks.

On 10/5/06, Matthew Yingling <[hidden email]> wrote:
What do you mean by "Why the end of the lines was not shown?"?

I found that changing

contrib\ports\v2pro\include\arch\cc.h

from

#define LWIP_PLATFORM_DIAG(x) do {xil_printf x;} while(0)

to

#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0)

helps make debugging actually useful on the Xilinx platform.  xil_printf
can't handle %p delimiters and requires explicit \r\n pairs instead of
inserting \r with \n, and this makes the LwIP debug output very difficult to
use otherwise.

Matthew

-----Original Message-----
From: lwip-users-bounces+matt=[hidden email]
[mailto:[hidden email]]On Behalf Of Haori
Yang
Sent: Thursday, October 05, 2006 5:31 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx


guys,

   I capture the output of the hyper terminal. for some reason, the error
about "can't allocate ** bytes" just disappeared. I didn't even change the
code. I enabled the xilmfs library and set the starting address of the
program in the 16Mb sdram the board has.

  the hyper terminal gives out this, before it freezes there. Why the end of
the lines was not shown? can you guys tell what's wrong here?

  another question would be when exactly should the led on the ethernet
connector be lighten? I connect a PC with a fpga board, using a crossover
cable. the leds were never lighten. I assume the connection between these
two was not created at all, right?

  thanks,

haori

netif_set_ipaddr: netif address being changed
netif: IP address of interface    set to ...
netif: netmask of interface    set to ...
netif: GW address of interface    set to ...
netif: added interface e0 IP addr ... netmask ... gw ...
netif: setting default interface e0
udp_bind(ipaddr = ..., port = )
udp_bind: bound to ..., port
udp_connect: connected to ..., port
pbuf_alloc(length=)
pbuf_alloc(length=) ==
udp_send
pbuf_header: failed as  <
pbuf_alloc(length=)
pbuf_alloc(length=) ==
pbuf_chain:  references
udp_send: added header pbuf  before given pbuf
udp_send: sending datagram of length
udp_send: UDP packet length
udp_send: UDP checksum 0xB66A
udp_send: ip_output_if (,,,,IP_PROTO_UDP,)
pbuf_header: old  new  (619814488)
ip_output_if: e0
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |          | (v, hl, tos, len)
+-------------------------------+
|          ||       | (id, flags, offset)
+-------------------------------+
|    |    |    0x00FF     | (ttl, proto, chksum)
+-------------------------------+
|  149  |  199  |    6  |  108  | (src)
+-------------------------------+
|  149  |  199  |    6  |  107  | (dest)
+-------------------------------+
netif->output()pbuf_header: old  new  (619814468)
pbuf_take()
pbuf_take: skipping pbuf not of type PBUF_REF
pbuf_take: skipping pbuf not of type PBUF_REF
pbuf_take: end of chain reached.
pbuf_alloc(length=)
pbuf_alloc(length=) ==







On 10/5/06, Sathya Thammanur <[hidden email]> wrote:
Hi Haori,
You need to ensure that the hardware is working first. Can you check if the
TestApp_Peripheral example that is created as part of BSB works without any
issues? If not then the hardware has issues. If it does work, then you try
to see if you are getting interrupts with Emac or not. You can enable the
debug option for lwip library in XPS and see if your hyper terminal does
print out all the debug messages when you try to ping th eboard.

Sathya




On 10/4/06, Haori Yang <[hidden email] > wrote:
You are absolutely right about this! , you are good... I found this error.
the code can be compiled all right.

But the whole design just doesn't work.

I was checking the mail archive, I saw that you've done this kind of stuff
before. could you give me some hint what could possiblely went wrong? My
setup:  AvNet Virtex4LX25 Evaluation board + Xilinx EDK 8.1i. I connected my
desktop and the board with a crossover cable.

I used BSB create a project. then, go to software platform setting, select
lwip. set the 'emac_instances' of the lwip.
Generate netlist, Generate library. create a new project, import the code I
post. compile the project (set as 'initialize bram'). update bit file,
download bit file to fpga. the 'done' comes on.

but my desktop always shows that 'network connection' is unplugged... and
the led on the ethernet connector never comes up.

It's so simple that I can't think of anything that might be wrong. it's
killing me...

I'll atttach the mhs and mss files.




On 10/4/06, Pisano, Edward A < [hidden email]> wrote:
All of your "undefined reference" errors are to functions in the lwIP
library, but I don't see the lwIP4lib called out on your 'make' line.
The –L identifies the correct path to the directory containing the library,
but you need to add the "-llwip4" to your make line.  If you're working in
the XiLinx Platform Studio, right-click on "Compiler Options", go to the
"Paths and Options" tab and specify 'lwip4' in the "Libraries to Link
against" field.

Regards,
Ed



From: lwip-users-bounces+edward.pisano=[hidden email]
[mailto:[hidden email]] On Behalf Of
Haori Yang
Sent: Wednesday, October 04, 2006 6:52 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx

Hi, Ed

  do you happen to know why am I getting a lot of undefined reference?

  like this?  I am using EDK 8.1i

  At Local date and time: Wed Oct 04 21:49:35 2006
xbash -q -c "cd /cygdrive/e/Temp/MicroDemo/WebClient2/; /usr/bin/make -f
system.make WebClient_program; exit;" started...
mb-gcc -O2 Send2PC/send.c  -o WebClient/executable.elf \
    -mno-xl-soft-mul     -Wl,-T -Wl,TestApp_Peripheral/src/TestApp_Periphera
l_LinkScr.ld  -g    -I./microblaze_0/include/  -L./microblaze_0/lib/  \


Send2PC/send.c:79:2: warning: no newline at end of file

/cygdrive/c/DOCUME~1/Haori/LOCALS~1/Temp/ccH5S4ia.o: In function `main':
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:30: undefined reference
to `mem_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:35: undefined reference
to `memp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:36: undefined reference
to `pbuf_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:39: undefined reference
to `xemacif_setmac'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:44: undefined reference
to `netif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:46: undefined reference
to `udp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:48: undefined reference
to `mem_malloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:50: undefined reference
to `XEmacIf_ConfigTable'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference
to `xemacif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference
to `ip_input'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference
to `netif_add'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference
to `netif_set_default'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference
to `udp_new'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:64: undefined reference
to `udp_connect'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:68: undefined reference
to `pbuf_alloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:74: undefined reference
to `udp_send'
collect2: ld returned 1 exit status
make: *** [WebClient/executable.elf] Error 1

Done!
On 10/4/06, Pisano, Edward A < [hidden email]> wrote:
Hello,
I just glanced at the code, but noticed that your remote_pcb is not bound to
a local endpoint.  I believe both ends must be grounded with an endpoint.
Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address
and port number, but isn't bound to a local IP Address and port number.


// local_pcb = udp_new();
remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
udp_connect(remote_pcb, &remoteip, (u16_t)8080);

Regards,
Ed




From: lwip-users-bounces+edward.pisano= [hidden email] [mailto:
lwip-users-bounces+edward.pisano=[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

Guys,

   I am trying to implement a udp client on a xilinx fpga. here's my code. I
am getting "undefined reference" errors. could you take a look at it?
Thanks.

  I appreciate your help.


#include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2],
ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2],
gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
default_netif = (netif *) tmpPtr;
default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);

netif_set_default(default_netif);


// local_pcb = udp_new();
remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
udp_connect(remote_pcb, &remoteip, (u16_t)8080);

p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
p->payload = buffer;


for (;;)
{
     udp_send(remote_pcb, p);
}

  return 0;

}

_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users





_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users






_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: udp/lwip on xilinx

Haori Yang
In reply to this post by Sathya Thammanur
Hi, Sathya

   do I have to enable interrupts when I create the project using BSB? is it required for my design (udp client)?
 
   the pc can't recognize the board at all. it says 'cable unplugged'.

   I download the webserver came with the board. it seems to work fine.

  I believe it's a software issue. maybe I didn't set it right while I create the project? is there any special settings? do I have to enable xilfms also? because I am getting 'can't allocate ** bytes' error from calling of mem_malloc. should I enable xilfms and put the program on the external memory(sdram)?

On 10/5/06, Sathya Thammanur <[hidden email]> wrote:
Hi Haori,
You need to ensure that the hardware is working first. Can you check if the TestApp_Peripheral example that is created as part of BSB works without any issues? If not then the hardware has issues. If it does work, then you try to see if you are getting interrupts with Emac or not. You can enable the debug option for lwip library in XPS and see if your hyper terminal does print out all the debug messages when you try to ping th eboard.

Sathya



On 10/4/06, Haori Yang <[hidden email]> wrote:
You are absolutely right about this! , you are good... I found this error. the code can be compiled all right.

But the whole design just doesn't work.

I was checking the mail archive, I saw that you've done this kind of stuff before. could you give me some hint what could possiblely went wrong? My setup:  AvNet Virtex4LX25 Evaluation board + Xilinx EDK 8.1i. I connected my desktop and the board with a crossover cable.

I used BSB create a project. then, go to software platform setting, select lwip. set the 'emac_instances' of the lwip.
Generate netlist, Generate library. create a new project, import the code I post. compile the project (set as 'initialize bram'). update bit file, download bit file to fpga. the 'done' comes on.

but my desktop always shows that 'network connection' is unplugged... and the led on the ethernet connector never comes up.

It's so simple that I can't think of anything that might be wrong. it's killing me...

I'll atttach the mhs and mss files.



On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

All of your "undefined reference" errors are to functions in the lwIP library, but I don't see the lwIP4lib called out on your 'make' line.  The –L identifies the correct path to the directory containing the library, but you need to add the "-llwip4" to your make line.  If you're working in the XiLinx Platform Studio, right-click on "Compiler Options", go to the "Paths and Options" tab and specify 'lwip4' in the "Libraries to Link against" field.

 

Regards,

Ed


From: lwip-users-bounces+edward.pisano=[hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:52 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] udp/lwip on xilinx

 

Hi, Ed

  do you happen to know why am I getting a lot of undefined reference?

  like this?  I am using EDK 8.1i

  At Local date and time: Wed Oct 04 21:49:35 2006
 xbash -q -c "cd /cygdrive/e/Temp/MicroDemo/WebClient2/; /usr/bin/make -f system.make WebClient_program; exit;" started...
mb-gcc -O2 Send2PC/send.c  -o WebClient/executable.elf \
    -mno-xl-soft-mul     -Wl,-T -Wl,TestApp_Peripheral/src/TestApp_Peripheral_LinkScr.ld  -g    -I./microblaze_0/include/  -L./microblaze_0/lib/  \
 

Send2PC/send.c:79:2: warning: no newline at end of file

/cygdrive/c/DOCUME~1/Haori/LOCALS~1/Temp/ccH5S4ia.o: In function `main':
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:30: undefined reference to `mem_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:35: undefined reference to `memp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:36: undefined reference to `pbuf_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:39: undefined reference to `xemacif_setmac'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:44: undefined reference to `netif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:46: undefined reference to `udp_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:48: undefined reference to `mem_malloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:50: undefined reference to `XEmacIf_ConfigTable'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `xemacif_init'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `ip_input'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:52: undefined reference to `netif_add'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `netif_set_default'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:60: undefined reference to `udp_new'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:64: undefined reference to `udp_connect'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:68: undefined reference to `pbuf_alloc'
/cygdrive/e/Temp/MicroDemo/WebClient2/Send2PC/send.c:74: undefined reference to `udp_send'
collect2: ld returned 1 exit status
make: *** [WebClient/executable.elf] Error 1

Done!

On 10/4/06, Pisano, Edward A <[hidden email]> wrote:

Hello,

I just glanced at the code, but noticed that your remote_pcb is not bound to a local endpoint.  I believe both ends must be grounded with an endpoint.  Your remote_pcb uses udp_connect() to specify the remote endpoint IP Address and port number, but isn't bound to a local IP Address and port number.

 

 

// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_bind(remote_pcb, IP_ADDR_ANY, (u16_t)8081);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);

 

Regards,

Ed

 


From: lwip-users-bounces+edward.pisano= [hidden email] [mailto:[hidden email]] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: [hidden email]
Subject: [lwip-users] udp/lwip on xilinx

 

Guys,
 
   I am trying to implement a udp client on a xilinx fpga. here's my code. I am getting "undefined reference" errors. could you take a look at it? Thanks.

  I appreciate your help.


 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}


_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
<a href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.nongnu.org/mailman/listinfo/lwip-users




_______________________________________________
lwip-users mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.nongnu.org/mailman/listinfo/lwip-users" target="_blank"> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users