__user_setup_stackheap() sets up and returns the locations of the initial stack and heap. If you define this function, it is called by the C library during program start-up.

When __user_setup_stackheap() is called, SP has the same value it had on entry to the application. If this was set to a valid value before calling the C library initialization code, it can be left at this value. If SP is not valid, __user_setup_stackheap() must change this value before using any stack and before returning.

__user_setup_stackheap() returns the:

If this function is re-implemented, it must:

To create a version of __user_setup_stackheap() that inherits SP from the execution environment and does not have a heap:

There is no limit to the size of the stack. However, if the heap region grows into the stack, malloc() attempts to detect the overlapping memory and fails the new memory allocation request.


Any re-implementation of __user_setup_stackheap() must be in assembler.

Show/hideSee also


ARM C and C++ Libraries and Floating-Point Support User Guide:

Copyright © 2014 ARM. All rights reserved.ARM DUI 0809B