heap checking

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

heap checking

293 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cojanprins on Tue Mar 17 04:14:27 MST 2015
I want to add some checking at the heap. I have placed the heap in external SD RAM using linker script (not managed script). I would like lines like:

    PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : __start_SDRAM_HEAP);
    PROVIDE(_pvHeapLimit = DEFINED(__user_heap_XXXX) ? __user_heap_XXXX : __top_SDRAM_HEAP);

My question: which global name is available for the "end-of-heap" (instead of __user_heap_XXXX)?

Can it be done in this way?

Heap is running correctly in external SDRAM.

Thanks in advance
2 Replies

240 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cojanprins on Mon Mar 23 06:28:33 MST 2015
OK, thanks for your help, I've implemented it in this way, seems to be working. Kind regards, Cojan.

240 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Mar 17 05:31:42 MST 2015
If you are maintaining your own linker scripts, then the simplest approach is probably just to define __top_SDRAM_HEAP in the linker script itself. Just add something along the lines of the following to the top of the script.

__top_SDRAM_HEAP = 0x28000000 + 0x10000;


[Changes addresses to match your system]

The PROVIDE statement you quote should then pick this up and assign the value to the __pvHeapLimit symbol, which is what the heap code in the Redlib C library uses as the end of heap value.

Alternatively, take a look at http://www.lpcware.com/content/faq/lpcxpresso/heap-checking-redlib

Regards,
LPCXpresso Support