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.13. Memory model functions

FunctionDescription
__rt_stackheap_init()Sets the application stack and initial heap. See __rt_stackheap_init().
__rt_heap_extend()Returns a new block of memory to add to the heap. See __rt_heap_extend().
__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().
__rt_stack_overflow()Handles stack overflows. (This is only required to be implemented for stack-checked variants.) See __rt_stack_overflow().
Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D
Non-Confidential