29.10.2014 Views

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Using</strong> <strong>the</strong> Inline and Embedded Assemblers of <strong>the</strong> <strong>ARM</strong> <strong>Compiler</strong><br />

7.8 Inline assembler register restrictions in C and C++ code<br />

Registers such as r0-r3, sp, lr, and <strong>the</strong> NZCV flags in <strong>the</strong> CPSR must be used with caution. If C<br />

or C++ expressions are used, <strong>the</strong>se might be used as temporary registers and NZCV flags might<br />

be corrupted by <strong>the</strong> compiler when evaluating <strong>the</strong> expression.<br />

The pc, lr, and sp registers cannot be explicitly read or modified using inline assembly code<br />

because <strong>the</strong>re is no direct access to any physical registers. However, <strong>the</strong> intrinsics __current_pc,<br />

__current_sp, and __return_address can be used to read <strong>the</strong>se registers.<br />

7.8.1 See also<br />

Concepts<br />

• Inline assembler and register access in C and C++ code on page 7-18<br />

• Restrictions on inline assembly operations in C and C++ code on page 7-11.<br />

Reference<br />

<strong>Compiler</strong> Reference:<br />

• __current_pc intrinsic on page 5-63<br />

• __current_sp intrinsic on page 5-64<br />

• __return_address intrinsic on page 5-77.<br />

<strong>ARM</strong> DUI 0375C Copyright © 2007-2008, 2011 <strong>ARM</strong>. All rights reserved. 7-12<br />

ID061811<br />

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!