06.02.2013 Views

ARM Compiler toolchain Using the Linker - ARM Information Center

ARM Compiler toolchain Using the Linker - ARM Information Center

ARM Compiler toolchain Using the Linker - ARM Information Center

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

8.7 Specifying stack and heap using <strong>the</strong> scatter file<br />

8.7.1 See also<br />

<strong>Using</strong> scatter files<br />

The <strong>ARM</strong> C library provides multiple implementations of <strong>the</strong> function<br />

__user_setup_stackheap(), and can select <strong>the</strong> correct one for you automatically from<br />

information given in a scatter file.<br />

To select <strong>the</strong> two region memory model, define two special execution regions in your scatter file<br />

named <strong>ARM</strong>_LIB_HEAP and <strong>ARM</strong>_LIB_STACK. Both regions have <strong>the</strong> EMPTY attribute. This causes <strong>the</strong><br />

library to select <strong>the</strong> non-default implementation of __user_setup_stackheap() that uses <strong>the</strong> value<br />

of <strong>the</strong> symbols:<br />

• Image$$<strong>ARM</strong>_LIB_STACK$$Base<br />

• Image$$<strong>ARM</strong>_LIB_STACK$$ZI$$Limit<br />

• Image$$<strong>ARM</strong>_LIB_HEAP$$Base<br />

• Image$$<strong>ARM</strong>_LIB_HEAP$$ZI$$Limit<br />

Only one <strong>ARM</strong>_LIB_STACK or <strong>ARM</strong>_LIB_HEAP region can be specified, and you must allocate a size,<br />

for example:<br />

<strong>ARM</strong>_LIB_HEAP 0x20100000 EMPTY 0x100000-0x8000 ; Heap starts at 1MB<br />

; and grows upwards<br />

<strong>ARM</strong>_LIB_STACK 0x20200000 EMPTY -0x8000 ; Stack space starts at <strong>the</strong> end<br />

; of <strong>the</strong> 2MB of RAM<br />

; And grows downwards for 32KB<br />

You can use a combined stack and heap region by defining a single execution region named<br />

<strong>ARM</strong>_LIB_STACKHEAP, with <strong>the</strong> EMPTY attribute. This causes __user_setup_stackheap() to use <strong>the</strong><br />

value of <strong>the</strong> symbols Image$$<strong>ARM</strong>_LIB_STACKHEAP$$Base and<br />

Image$$<strong>ARM</strong>_LIB_STACKHEAP$$ZI$$Limit.<br />

Note<br />

If you re-implement __user_setup_stackheap(), this overrides all library implementations.<br />

Tasks<br />

Developing Software for <strong>ARM</strong> ® Processors:<br />

• Placing <strong>the</strong> stack and heap on page 3-13.<br />

Concepts<br />

Migration and Compatibility:<br />

• C and C++ library changes between RVCT v2.2 and RVCT v3.0 on page 9-5.<br />

Reference<br />

• Region-related symbols on page 7-5.<br />

<strong>Using</strong> <strong>ARM</strong> ® C and C++ Libraries and Floating-Point Support:<br />

• __user_setup_stackheap() on page 2-60<br />

• Legacy function __user_initial_stackheap() on page 2-70.<br />

<strong>ARM</strong> DUI 0474C Copyright © 2010-2011 <strong>ARM</strong>. All rights reserved. 8-12<br />

ID080411 Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!