Keil™, An ARM® Company

RealView Libraries and Floating Point Support Guide

Creating the heap

3.3.2. Creating the heap

Specify the start and end of the heap by defining symbols __heap_base and __heap_limit respectively. On completion, you can use the heap functions in the normal way.

Note

The __heap_limit must point to the byte beyond the last byte in the heap region.

Example 3.6 shows how to set up the heap pointers using assembly language.

Example 3.6.  Assembly language

    EXPORT __heap_base
__heap_base EQU 0x400000        ; equal to the start of the heap

    EXPORT __heap_limit
__heap_limit EQU 0x800000       ; equal to the end of the heap

Example 3.7 shows how to set up the heap pointer using embedded assembler in C.

Example 3.7.  Embedded Assembler in C

__asm void dummy_function(void)
{
    EXPORT __heap_base
__heap_base EQU 0x400000        ; equal to the start of the heap

    EXPORT __heap_limit
__heap_limit EQU 0x800000       ; equal to the end of the heap
}
Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0378A