lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] help! netif_add() crashes machine.


From: Chris Jones
Subject: RE: [lwip-users] help! netif_add() crashes machine.
Date: Fri, 30 Apr 2004 19:26:09 -0400

Eric,
 
You can't use seperate tasks/threads for the timers.
 
The core of LWIP is not thread safe and problems arise when timers are executing
interleaved with the tcp/ip thread.
 
I tried something similar on the Win 32 platform before porting to my DSP and
I was chasing my tail for weeks.
 
-Chris
 
-----Original Message-----
From: address@hidden [mailto:address@hiddenOn Behalf Of Eric Shufro
Sent: Friday, April 30, 2004 12:42 PM
To: address@hidden
Subject: [lwip-users] help! netif_add() crashes machine.

Hi, I am trying to use lwip 7.1 with ucos-ii on a mc9s12 microcontroller.

 

When I call netif_add(&netif, &ipaddr, &netmask, &gw, NULL, cs8900if_init, ip_input) that machine crashes shortly after, however control is returned to the task after the function is called, so I know its completing the netif_add function call.

 

By increasing the tasks stack size, I can prolong the crash by a few seconds, however I think I am a victim of stack corruption, not sure.

 

When I call netif_add() there are some things I am unsure of.

 

What do I do for ipaddr netmask etc if I plan to use DHCP?

 

Do I still set:

 

     IP4_ADDR(&gw, 192,168,0,1);

     IP4_ADDR(&ipaddr, 192,168,0,102);

     IP4_ADDR(&netmask, 255,255,255,0);    

 

For the function call, even if they will be ignored?

 

As for debugging, if I comment out the netif_add() the machine runs fine, however, if I call it, it runs and returns, but crashes the machine at some point later in time (a few seconds later depending on the stack size for the task). IF I comment out the body of the netif_add() it does the same thing.

 

This is why I think the function call itself is causing the stack to become corrupted! (from the parameters being passed).

 

Here is what I have done to initialize everything so far:

 

    sys_init();

    mem_init();

    memp_init();

    pbuf_init();

    netif_init();

    ip_init();

    udp_init();

    tcp_init();

 

I have also setup separate tasks for various timers:

 

dhcp_fine_tmr(); every 0.5 seconds

dhcp_coarse_tmr(); every second

etharp_tmr(); every 10 seconds

tcp_tmr(); every 250ms

 

I have registered the following callbacks:

 

tcp_accept(listen_pcb, accept_connection);

tcp_recv(listen_pcb, recv);

tcp_sent(connect_pcb, sent);

 

thanks for the help,

 

--eric shufro

 

 

 


reply via email to

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