You copied the Doc URL to your clipboard.

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:

  • Use a scatter file.

  • Define a symbol, __initial_sp, to be equal to the top of the stack.

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 armasm 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 inline assembler in C.

asm("  .global __initial_sp\n"
    "  .equ __initial_sp, 0x10000\n" /* equal to the top of the stack */
);

Was this page helpful? Yes No