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

Harald Kipp harald.kipp at egnite.de
Wed Apr 8 15:22:24 CEST 2009


Hi Malte,

Malte Marwedel wrote:
> In the file nut/arch/avr/os/nutinit.c I made the following changes:
> In line 156, I replaced #ifdef NUTXMEM_SIZE by
> #if defined(NUTXMEM_SIZE) && !defined(ARTHERNET1)
> and in the NutInitHeap() function, I added
> #ifdef ARTHERNET1
>      /* Add external RAM */
>      NutHeapAdd((u_char *)NUTXMEM_START, (u_short) NUTXMEM_SIZE - 32);
> #endif
> (I guess I could remove the -32 as the stack will stay in the internal RAM.)

ARTHERNET is one of the main reasons for nutinit becoming totally
contaminated with board-specific ifdefs...sigh! But that was my fault,
because I wanted to get it running and had no time to implement a more
general solution.

> This seems to work and does not loose the internal, faster, RAM for the 
> heap. I hope I did not oversaw some unexpected side-effects this changes 
>   could create.

Well, that depends. If you are using the standard linker script, then
this may fail as soon as the variable space grows larger than the
internal RAM.


> As I had to do some more fixes in order to get my board working, where 
> should I submit them?

I'd be happy to have a look to it. Please send them to my email address
at egnite.de.

Harald




More information about the En-Nut-Discussion mailing list