[En-Nut-Discussion] no source in debugger solved, next step

Harald Kipp harald.kipp at egnite.de
Tue Oct 4 12:54:16 CEST 2011

Hi Klaus,

On 02.10.2011 22:27, Klaus Kloos wrote:

> [4] Connected, 1444 bytes free
> [4] Low mem
> [4] Low mem

The provided http sample is a bit overdone. Over the years, more and
more demo code had been added to it. Most real applications will not
need all the implemented features.

I just tried a short compile/link test with Nut/OS 4.10 and debugging
enabled. It turns out, that 12k static RAM is already required before
the application starts.

The debug version of the code requires more stack space. For this, the
Configurator simply defines


So every thread's stack space reservation is multiplied by 3. Probably
this could be lowered. And then there is a bug in httpserv.c itself,



 NutThreadCreate(thname, Service, (void *) (uptr_t) i,

which actually reserves 9k stack (3 * 3 * 1024) for each of the 4 server
threads. Together with statically allocated RAM space, we are nearly at
50k. The CPU has 64k RAM only.

This has been fixed in 4.10, but not yet in 4.8. I haven't been aware,
that this is a show stopper for the SAM7X-EK when running debug code.

Changing the line to

NutThreadCreate(thname, Service, (void *) (uintptr_t) i,

should help in a first step.

When compiling without debugging info, a lot more RAM is available.
Furthermore, you can build Nut/OS libs _without_ and your application
code _with_ debugging info to debug application code only.



More information about the En-Nut-Discussion mailing list