Datasheet
The C and C++ Libraries
4-68 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
4.9.2 Controlling the runtime memory model
The behavior of the heap and stack manager can be modified by redefining the functions
listed in Table 4-12.
The hidden static data for the library is provided by
__user_libspace()
. The static data
area is also used as a stack during the library initialization process. This function does
not normally require reimplementation. See Tailoring static data access on page 4-25.
4.9.3 Writing your own memory model
If the provided memory models do not meet your requirements, you can write your own.
A memory model must define the functions described in Table 4-13. All functions are
ARM-state functions. The library takes care of entry from Thumb state if this is
required. An incomplete prototype implementation for the model is provided in
rt_memory.s
located in the
Include
directory.
Use the prototype as a starting point for your own implementation.
Table 4-12 Memory model initialization
Function Description
__user_initial_stackheap()
Returns the location of the initial heap. See
__user_initial_stackheap() on page 4-69.
__user_heap_extend()
Returns the size and base address of a heap extra
block. See __user_heap_extend() on page 4-70.
__user_stack_slop()
Returns the amount of extra stack. See
__user_stack_slop() on page 4-71.
Table 4-13 Memory model functions
Function Description
__rt_stackheap_init()
Sets the application stack and initial heap. See __rt_stackheap_init() on
page 4-71.
__rt_heap_extend()
Returns a new block of memory to add to the heap. See __rt_heap_extend() on
page 4-73.
__rt_stack_postlongjmp()
Atomically sets the stack pointer and stack limit pointer to their correct values
after a call to longjmp. See __rt_stack_postlongjmp() on page 4-74.
__rt_stack_overflow()
Handles stack overflows. (This is only required to be implemented for
stack-checked variants.) See __rt_stack_overflow() on page 4-72.