lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Free LwIP resources


From: AMSN
Subject: Re: [lwip-users] Free LwIP resources
Date: Thu, 8 Sep 2011 02:25:31 -0700 (PDT)

Hi Richard, thanks a lot for your reply.

Please excuse me if the previous message isn't clear.

my application is built around graphical library and FreeRTOS, it contains
many modules for each module I associated a demo (for example web server). 
I need to start, stop and restart again each module separately without
stopping the whole application (without reset the microcontroller).

For the web server demo, I implement the following functions:
   - Webserver_start(): used to initialize the LwIP stack and create demo
tasks
   - Webserver_stop(): used to delete demo tasks and set down and remove the
netif

When I start the web server demo for the first time it works very well, but
if I restart again the demo doesn't work correctly (the ping doesn’t work at
all).

Below the code of Webserver_stop function:
Webserver_stop()
{
 // delete all tasks
  ….

 // Free LwIP resources
  netif_set_down(&netif);
  netif_remove(&netif);
}

Thank you very much !
Regards






FreeRTOS info wrote:
> 
> 
> 
> 
> On 08/09/2011 07:34, AMSN wrote:
>> 
>> Hi all,
>> 
>> I am using lwIP v1.3.2 with FreeRTOS v6.1.0. My application is a web
>> server
>> based on netconn API.
>> I have four tasks: tcpip, Ethernet interface, http and dhcp.
>> 
>> I am looking for a method that allow the following:
>> - delete all threads
>> - free LwIP resources
>> - set down and remove the netif
>> Since I need to re-start the application again.
>> 
>> Please give me some comments.
>> Thank you very much !
> 
> 
> First - I don't know exactly what you are doing, so this suggestion
> might not be appropriate, but if you are truly restarting the entire
> application, then the simplest thing to do would reset the
> microcontroller (either hard reset using the watchdog, or a soft reset
> in software).
> 
> Second - I don't want to get into FreeRTOS support here.  This is an
> lwIP list and FreeRTOS has its own support forum.  Superficially though,
> as far as deleting FreeRTOS tasks go, then when you create a task using
> xTaskCreate() you have the option of obtaining a handle to the task,
> that can then be used to delete the task.  You must do that with care
> though, if the task is blocked on a queue or such like.  You might also
> want to delete the queues, etc.  So you don't get into memory
> fragmentation problems though, it might be better to design your tasks
> such that they can go back to their start rather than deleting them then
> recreating them.
> 
> Restarting the lwIP tasks will cause the lwIP init and MAC driver
> functions to be called again, on the assumption they are not called from
> main() before the scheduler is started.  The effect will probably be
> different depending on the type of memory management you are using (for
> example, you don't want malloc() memory leaks if malloc() is used).  I
> will let the lwIP experts answer that fully though.
> 
> 
> Regards,
> Richard.
> 
> + http://www.FreeRTOS.org
> Designed for Microcontrollers.
> More than 7000 downloads per month.
> 
> 
> 
> 
> 
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users
> 
> 


-----
AMSN
-- 
View this message in context: 
http://old.nabble.com/Free-LwIP-resources-tp32421345p32422235.html
Sent from the lwip-users mailing list archive at Nabble.com.




reply via email to

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