Creating an initial stack pointer for use with microlib

To use microlib, you must specify an initial pointer for the stack. You can use either of the following methods to do this:

The scatter file method uses ARM_LIB_STACK and ARM_LIB_STACKHEAP.

Otherwise, specify the initial stack pointer by defining a symbol, __initial_sp, to be equal to the top of the stack. The initial stack pointer must be aligned to a multiple of eight bytes.

Example 14 shows how to set up the initial stack pointer using assembly language.

Example 14. Assembly language

    EXPORT __initial_sp
__initial_sp EQU 0x100000        ; equal to the top of the stack

Example 15 shows how to set up the initial stack pointer using embedded assembler in C.

Example 15. Embedded Assembler in C

__asm void dummy_function(void)
{
    EXPORT __initial_sp
__initial_sp EQU 0x100000        ; equal to the top of the stack
}

Show/hideSee also

Copyright © 2010-2011 ARM. All rights reserved.ARM DUI 0475C
Non-ConfidentialID080411