[En-Nut-Discussion] How to move the heap start address in Nut/OS?

Harald Kipp harald.kipp at egnite.de
Sat Apr 4 14:11:49 CEST 2009

Malte Marwedel wrote:

> I have a Arthernet board (with 512KB external memory), which has the
> memory of the CLPD and RTL chipset mapped directly after the internal
> RAM in the region 0x1100 to 0x14ff. 

>From a comment in arch/avr/os/nutinit.c:
"This had been messed up somehow. It's nice to have one continuous heap
area, but we lost the ability to have systems with a gap between
internal and external RAM."

> As __heap_start is somehow defined
> as 0x19f in my program, allocating heap results in overwriting the CLPD
> and RTL memory, so that the tcps demo crashes after a first connect and
> the httpd demo does not work at all.
> I tried to find a way to set __heap_start to 0x1500 but failed, to do
> so, becasue
> a) I did not found out where __heap_start is initialized or even defined.
> b) I tried to add __heap_start=(u_char *) 0x1500; in the NutCustomInit()
> function, but this had no effect.
> c) I tried to add it into the normal main function, but it did not work
> either.

This symbol is created by the linker and specified in the linker script.
It can be overridden by a linker option in app/Makedefs.avr-gcc:


Some more informations are provided at
but note that Nut/OS provides its own memory management, though in
general it is quite similar to the one provided by avr-libc.


More information about the En-Nut-Discussion mailing list