configTOTAL_HEAP_SIZE and lwIP

nobody wrote on Tuesday, January 17, 2006:

I’m currently testing the “lwIP_Demo_Rowley_ARM7” for AT91SAM7X. I try to
reduce RAM usage without affect the WEB page application (BasicWEB.c). I
removed all .c files in Demo App folder except for main.c, heap.c and

It looks like I cannot reduce "configTOTAL_HEAP_SIZE" under 10000 without
affecting the WEB page functionality. Is this normal ? Is there a mimimum
to allow to configTOTAL_HEAP_SIZE ?


rtel wrote on Tuesday, January 17, 2006:

I would expect to get it under that, but have not tried.

As downloaded:
The lwIP task has a stack size of 600*4 bytes,
The WebSvr task stack has a size of 250*4 bytes, and
The ETH_INT task stack has a size of 350*4 bytes.

If you have removed all the other demo tasks you are left with the idle task stack (small) and a few queues, TCB, etc.    10000 would seem more than enough.  Maybe there is a large queues used by the lwIP code somewhere, can’t remember.

The FreeRTOS kernel itself tries where possible not to use too much stack.  The lwIP code uses standard libraries (not efficient in GCC, but better if you are using Rowleys build), and is outside of the FreeRTOS kernel and therefore does not have the same design goal.  This is the reason for the 600*4 stack used by the lwIP task.

I would suggest setting a break point in the function pvPortMalloc() in the file heap_2.c.  When the execution breaks here you can inspect the xWantedSize value (the number of bytes being obtained), and see when large chunks of memory are being allocated and why.  This will assist in diagnosis.

Are you using command line GCC or Rowley?


nobody wrote on Wednesday, January 18, 2006:

I’m using Rowley.