lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] udp/lwip on xilinx


From: Haori Yang
Subject: Re: [lwip-users] udp/lwip on xilinx
Date: Wed, 4 Oct 2006 22:40:46 -0400

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 <address@hidden> 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= address@hidden [mailto:address@hidden] 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 <address@hidden> 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= address@hidden [mailto: address@hidden] On Behalf Of Haori Yang
Sent: Wednesday, October 04, 2006 6:17 PM
To: address@hidden
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
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users



reply via email to

[Prev in Thread] Current Thread [Next in Thread]