[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] lwip and OS - memory management
From: |
Bill Yang |
Subject: |
RE: [lwip-users] lwip and OS - memory management |
Date: |
Mon, 1 Mar 2010 16:12:54 -0700 |
Hi,
I wonder what different between heap and pools is used. I got a little bit
rusty on it. I current tried lwIPv1.3.0 with FreeRTOS. The FreeRTOS set up heap
2 with the size 24000. The heap.o showed on RTOSDemo.map file showed
24000 heap_2.o, also showed the mem.c and memp.c file usages.
18452 mem.o
11335 memp.o
So the three have occupied about 52K SRAM already. Plus others, my system only
has 64K SRAM. It will run out of the memory.
My question is if it can only use heap memory and does not use or disable mem.c
and memp.c. Is it possible? I would like to increase the heap size to 30000 or
35000, instead of use both mem.o and memp.o.
Can I disable mem.c memp.c? If it can, how to do?
Thanks,
Bill Yang
Software Engineer
direct: +1 801.433.6354
email: address@hidden
Parvus
RUGGED SOLUTIONS for REAL WORLD APPLICATIONS
USA – 3222 S. Washington St. | Salt Lake City, Utah 84115 | Tel. +1
801.483.1533 | Fax +1 801.483.1523 |
www.parvus.com
A Member of EUROTECH GROUP
-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of address@hidden
Sent: Monday, March 01, 2010 12:15 PM
To: address@hidden
Subject: Re: [lwip-users] lwip and OS - memory management
I guess these checks should be omitted when using the heap instead of pools.
Simon
Martin Velek wrote:
> Hi,
>
> there is a sanity check in init.c
>
> #if (LWIP_UDP&& (MEMP_NUM_UDP_PCB<=0))
> #error "If you want to use UDP, you have to define
> MEMP_NUM_UDP_PCB>=1 in your lwipopts.h"
> #endif
> #if (LWIP_TCP&& (MEMP_NUM_TCP_PCB<=0))
> #error "If you want to use TCP, you have to define
> MEMP_NUM_TCP_PCB>=1 in your lwipopts.h"
> #endif
> /* There must be sufficient timeouts, taking into account requirements
> of the subsystems. */
> #if ((NO_SYS==0)&& (MEMP_NUM_SYS_TIMEOUT< (LWIP_TCP + IP_REASSEMBLY
> + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS +
> PPP_SUPPORT)))
> #error "MEMP_NUM_SYS_TIMEOUT is too low to accomodate all required
> timeouts"
> #endif
>
> etc.
>
> I will try to find if these values have effect.
>
> Martin
>
>
> On 1 March 2010 10:45, Kieran Mansley<address@hidden> wrote:
>
>> On Sun, 2010-02-28 at 13:16 +0100, Martin Velek wrote:
>>
>>> Hello,
>>>
>>> I am running a lwip 1.3.2 with FreeRTOS. I am using own
>>> malloc/free/calloc/realloc memory management. What should I setup in
>>> the lwipopts.h if I would like use only malloc/free... functions for
>>> pbuf's, internal sturctures (arp tables?) and OS support?
>>>
>>> Currently I have:
>>>
>>> #define SYS_LIGHTWEIGHT_PROT 1
>>> #define NO_SYS 0
>>>
>>> #include<stdlib.h> // there are undeclared referneces to free...
>>> #define MEM_LIBC_MALLOC 1
>>> #define MEMP_MEM_MALLOC 1
>>> #define MEM_USE_POOLS 0
>>>
>>> Can I do not care about PBUF_POOL_SIZE,
>>>
>> As you've set MEMP_MEM_MALLOC to 1 you will be using malloc instead of
>> memp_malloc, and so the PBUF_POOL_SIZE is irrelevant.
>>
>>
>>> MEM_SIZE,
>>>
>> This would normally specify the heap size used for mem_malloc, so you
>> don't need it. You might want to check that mem_init isn't called to
>> avoid wasting memory.
>>
>>
>>> MEMP_NUM_PBUF,
>>> MEMP_NUM_NETBUF, etc?
>>>
>> As you've defined MEMP_MEM_MALLOC to 1 the other MEMP_ values are all
>> unused I think. You should probably still set them to zero rather than
>> undefined though.
>>
>> If you have problems with any of this let us know as the dependencies
>> are complex and it wouldn't surprise me if there was a mistake
>> somewhere.
>>
>> Kieran
>>
>>
>>
>> _______________________________________________
>> 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