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

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

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

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

7.51 Differences in compiler support of inline and embedded assembly code<br />

There are differences between <strong>the</strong> way inline and embedded assembly is compiled:<br />

• Inline assembly code uses a high level of processor abstraction, and is integrated with <strong>the</strong><br />

C and C++ code during code generation. There<strong>for</strong>e, <strong>the</strong> compiler optimizes <strong>the</strong> C and C++<br />

code and <strong>the</strong> assembly code toge<strong>the</strong>r.<br />

• Unlike inline assembly code, embedded assembly code is assembled separately from <strong>the</strong><br />

C and C++ code to produce a compiled object that is <strong>the</strong>n combined with <strong>the</strong> object from<br />

<strong>the</strong> compilation of <strong>the</strong> C or C++ source.<br />

• Inline assembly code can be inlined by <strong>the</strong> compiler, but embedded assembly code cannot<br />

be inlined, ei<strong>the</strong>r implicitly or explicitly.<br />

Table 7-1 summarizes <strong>the</strong> main differences between inline assembler and embedded assembler.<br />

Table 7-1 Differences between inline and embedded assembler<br />

Feature Embedded assembler Inline assembler<br />

Instruction set <strong>ARM</strong> and Thumb. <strong>ARM</strong> only.<br />

<strong>ARM</strong> assembler directives All supported. None supported.<br />

<strong>ARM</strong>v6 instructions All supported. Supports most instructions, with some<br />

exceptions, <strong>for</strong> example SETEND and<br />

some of <strong>the</strong> system extensions. The<br />

complete set of <strong>ARM</strong>v6 SIMD<br />

instructions is supported.<br />

<strong>ARM</strong>v7 instructions All supported. Not supported.<br />

C/C++ expressions Constant expressions only. Full C/C++ expressions.<br />

Optimization of assembly code No optimization. Full optimization.<br />

Inlining Never. Possible.<br />

Register access<br />

Return instructions<br />

Specified physical registers<br />

are used. You can also use<br />

PC, LR and SP.<br />

You must add <strong>the</strong>m in your<br />

code.<br />

Uses virtual registers. <strong>Using</strong> sp (r13), lr<br />

(r14), and pc (r15) gives an error.<br />

Generated automatically. (The BX, BXJ,<br />

and BLX instructions are not supported.)<br />

BKPT instruction Supported directly. Not supported.<br />

7.51.1 See also<br />

Concepts<br />

• Differences between expressions in embedded assembler and C or C++ on page 7-44<br />

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

• Legacy inline assembler that accesses sp, lr, or pc on page 7-56<br />

• <strong>Compiler</strong> support <strong>for</strong> inline assembly language on page 7-4<br />

• <strong>Compiler</strong> support <strong>for</strong> embedded assembler on page 7-36.<br />

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

ID061811<br />

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!