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: Thu, 5 Oct 2006 15:29:53 -0400

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 < address@hidden> 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 <address@hidden > 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 < address@hidden> 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=address@hidden [mailto:address@hidden] 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 < 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



_______________________________________________
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]