4.9.1. The memory models

You can select either of the following memory models:

Single memory region

The stack grows downward from the top of the memory region while the heap grows upwards from the bottom of the region. This is the default.

Two memory regions

One memory region is for the stack and the other is for the heap. The size of the heap region can be zero. The stack region can be in allocated memory or inherited from the execution environment.

To use the two-region model rather than the default single-region model, use either:

  • IMPORT __use_two_region_memory from assembly language

  • #pragma import(__use_two_region_memory) from C.

Caution

If you use the two-region memory model and do not provide any heap memory, you cannot call malloc(), use stdio, or get command-line arguments for main().

If you set the size of the heap region to zero and define __user_heap_extend() as a function that can extend the heap, the heap is created when it is required.

See the description of __use_no_heap() in Tailoring storage management, for how to issue a warning message if the heap or heap region is used.

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D
Non-Confidential