[En-Nut-Discussion] EIR & RAM-Test

Harald Kipp harald.kipp at egnite.de
Fri Oct 19 17:23:40 CEST 2012


Hi Markus,

On 19.10.2012 16:03, Markus Dost wrote:

> thank you for your help. I've tried your advices and the .map-file looks 
> right. But when I try to debug it with OpenOCD + Turtelizer 2 in Eclipse 
> it chrashes calling the NutHeapAdd()-function. Changing the memory size 
> to 32768 and the memory start adress to 0x200000 in the configurator 
> RTOS-Kernel -> Memory Mangement didn't help.

Let me see. For GCC we have

NutHeapAdd(HEAP_START, HEAP_SIZE & ~3);

with

#define NUTMEM_END (uintptr_t)(NUTMEM_START + NUTMEM_SIZE - 1U)
#define HEAP_START  &__heap_start
#define HEAP_SIZE  ((uintptr_t) (NUTMEM_END - 256 - (uintptr_t)
(&__heap_start)))

With your change we should get

 NUTMEM_END = 0x200000 + 32768 - 1 = 0x207FFF

__heap_start is provided by the linker script. According to
app/events.map, it is

 0x00200a5c PROVIDE (__heap_start, .)

which results in

 HEAP_SIZE = 0x207FFF - 256 - 0x00200a5c = 29859 Bytes

Cutting off the 2 lower bits

 NutHeapAdd(0x200a5c, 29856);

This looks perfectly right to me.

Where's __heap_start in your map file?

Regards,

Harald




More information about the En-Nut-Discussion mailing list