lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] LWIP newbie


From: Sirjee Rooplall
Subject: Re: [lwip-users] LWIP newbie
Date: Fri, 12 Feb 2010 11:42:06 +0200

Hi Simon,
 
Thanks for the detailed answer, the code actually works with MEMP_NUM_PBUF set to zero, but I was not sure how it fits together.
 
I have moved both mem buffers and memp buffers to heap using the following definitions in lwipopt.h
#define MEM_LIBC_MALLOC                    1
#define MEMP_MEM_MALLOC                 1
 
The reason for the MEMP question is that I am trying to track a bug that causes my system to lockup after a particular PPP packet arrives and pppInProc processes it, then passes it ip_input after which it gets posted into the mailbox using sys_mbox_post, after this I think a Task switch happens and my system locks up.
 
The pppThreadHandle which points to the Task stack for some reason changed value when the message was posted.
 
But as I said, it only happens when a paticular pkt arrives.
 
Not sure where to look.
 
Oh sorry, by the way I am using UC3A0512 device with freeRTOS and LWIP 1.3.2
 
Any pointers would help!
 
 
 
Kind Regards,
 
Sirjee Rooplall
Figment Design laboratories (Pty) Ltd
mailto:
address@hidden
Mobile: +27 (0)83 230 8466
----- Original Message -----
Sent: Friday, February 12, 2010 11:04 AM
Subject: Re: [lwip-users] LWIP newbie

Sirjee Rooplall wrote:
Can some explain the difference between memp_malloc and mem_malloc, or point me to any documentation that will explain this to me.
mem_malloc allocates data from a heap, much like the std-C malloc. Since a heap can be slow (to find a suitably sized free area) and can fragment over time, lwIP prefers to use memory pools (memp_malloc). We have dedicated pools for many structures, the amount of which is configurable by the MEMP_NUM_* options (except for PBUF_POOL pbufs, which are configured by PBUF_POOL_SIZE for historical reasons :-( - before 1.2.0, the pbuf pool had its own pool implementation).
Does MEMP_NUM_PBUF have to be dfined for memp_malloc to work?
I never tried setting it to zero, but it should work. If not, we can make it to.
I am not clear as to what this value should be set to.
It configures the number of struct pbuf structs in that pool. These structs are used when allocating PBUF_ROM or PBUF_REF pbufs (as documented in opt.h). These pbufs are used for IP fragmentation and NETCONN_NOCOPY (i.e.  TCP_WRITE_FLAG_COPY not set when calling tcp_write).
I receive data from a serial port, then build a pkt, and use netconn_write with NETCONN_COPY parameter to send this data to our server through the PPP layer. So having said this, do I need to define MEMP_NUM_PBUF to a minimal value, what would happen if it is defined as zero?
Since you are using netconn_write with NETCONN_COPY only, PBUF_ROM/REF pbufs should never be used (I'd have to verify this, though) and you might set the define to zero.

Simon


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