Author Topic: Heap_Mem & HEAP_START_ADDRESS  (Read 9962 times)

Offline hervé

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
Heap_Mem & HEAP_START_ADDRESS
« on: January 25, 2010, 09:21:52 AM »
Hello Mark,

I think I quite misunderstood the stack and heap variables definition.

On LPC23xx_keil.s I wrote :
Code: [Select]
         EXPORT  Stack_Mem
          AREA    STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem       SPACE   USR_Stack_Size

Heap_Size       EQU     0x00004800
          AREA    HEAP, NOINIT, READWRITE, ALIGN=3
Heap_Mem        SPACE   Heap_Size

0x00004800    is what I considered correct for my application

On TaskConfig.h
Code: [Select]
const HEAP_NEEDS ctOurHeap[] = {
    {DEFAULT_NODE_NUMBER, OUR_HEAP_SIZE},                                // our node requires this amount of heap space
    {0}                                                                  // end
};
with    
#define OUR_HEAP_SIZE (HEAP_REQUIREMENTS)((18*1024)*MEM_FACTOR)
So both have the same value.....

But on LPC23XX.c I saw that you wrote

        #define HEAP_START_ADDRESS  &Stack_Mem                          // Keil - start of stack

So I don't understand why you do this ?
On the map file I saw
   0x400042a8   0x00004800   Zero   RW         2637    HEAP                lpc23xx_keil.o
    0x40008aa8   0x00000434   Zero   RW         2636    STACK               lpc23xx_keil.o

But in fact the uTasker Heap is starting at 0x40008aa8 and reserve 0x4800 byte for uTaskerHeap.
Does that means that the Heap define in lpc23xx_keil.s is not used, and do I have to put its value to zero (to recover this memory) ?

Please clarify these varaibles for me.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Heap_Mem & HEAP_START_ADDRESS
« Reply #1 on: January 25, 2010, 12:35:51 PM »
Hi Hervé

You may find this thread contains all of the information that you need: http://www.utasker.com/forum/index.php?topic=96.msg384#msg384

The question is whether you use malloc() in your application. If not, you can set the library heap size to 0 and thus save this reserved areas in RAM.

Regards

Mark

Offline hervé

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
Re: Heap_Mem & HEAP_START_ADDRESS
« Reply #2 on: January 28, 2010, 08:35:27 AM »
Perfect I got it.

Thanks a lot.