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

Malte Marwedel m.marwedel at onlinehome.de
Fri Apr 3 20:48:15 CEST 2009


Hello,
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. 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.

I saw that the first malloc in a program always returned an address of
about 0x700, so I added malloc(0xe00); as workaround, to prevent the
memory area from being used to the beginning of the two example apps
above. Then they worked flawlessly.

Does anybody know where I could change the __heap_start in a good way?
Moreover I found:
#define __bss_end	__heap_start
so, would not changing __heap_start then result in the bss section
ranging into the CLPD area?

Greetings,
Malte Marwedel




More information about the En-Nut-Discussion mailing list