| |||
| Home > The C and C++ Libraries > Tailoring the runtime memory model > 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 5.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 5.13. Memory model functions
| Function | Description |
|---|---|
__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(). |