Keil Logo Arm Logo

Libraries and Floating Point Support Guide

Creating an initial stack pointer for use with microlib

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 15 shows how to set up the initial stack pointer using assembly language.

Example 15. Assembly language

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

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

Example 16. Embedded Assembler in C

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

Copyright © 2007-2008, 2011-2012 ARM. All rights reserved.ARM DUI 0378D
Non-ConfidentialID062912

arm-logo-small

Keil logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.