ARM ® Compiler v5.06 for µVision ® Version 5 armasm User Guide PDF

Title ARM ® Compiler v5.06 for µVision ® Version 5 armasm User Guide
Author Ömer Faruk Arslan
Pages 655
File Size 2 MB
File Type PDF
Total Downloads 227
Total Views 694

Summary

ARM® Compiler v5.06 for µVision® Version 5 armasm User Guide Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved. ARM DUI0379G ARM® Compiler v5.06 for µVision® ARM® Compiler v5.06 for µVision® armasm User Guide Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserv...


Description

ARM® Compiler v5.06 for µVision® Version 5

armasm User Guide

Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved. ARM DUI0379G

ARM® Compiler v5.06 for µVision®

ARM® Compiler v5.06 for µVision® armasm User Guide Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved. Release Information

Document History Issue

Date

Confidentiality

Change

A

May 2007

Non-Confidential

Release for RVCT v3.1 for µVision

B

December 2008

Non-Confidential

Release for RVCT v4.0 for µVision

C

June 2011

Non-Confidential

Release for ARM Compiler v4.1 for µVision

D

July 2012

Non-Confidential

Release for ARM Compiler v5.02 for µVision

E

30 May 2014

Non-Confidential

Release for ARM Compiler v5.04 for µVision

F

12 December 2014

Non-Confidential

Release for ARM Compiler v5.05 for µVision

G

15 August 2015

Non-Confidential

Release for ARM Compiler v5.06 for µVision

Non-Confidential Proprietary Notice This document is protected by copyright and other related rights and the practice or implementation of the information contained in this document may be protected by one or more patents or pending patent applications. No part of this document may be reproduced in any form by any means without the express prior written permission of ARM. No license, express or implied, by estoppel or otherwise to any intellectual property rights is granted by this document unless specifically stated. Your access to the information in this document is conditional upon your acceptance that you will not use or permit others to use the information for the purposes of determining whether implementations infringe any third party patents. THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE DOCUMENT. For the avoidance of doubt, ARM makes no representation with respect to, and has undertaken no analysis to identify or understand the scope and content of, third party patents, copyrights, trade secrets, or other rights. This document may include technical inaccuracies or typographical errors. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THIS DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. This document consists solely of commercial items. You shall be responsible for ensuring that any use, duplication or disclosure of this document complies fully with any relevant export laws and regulations to assure that this document or any portion thereof is not exported, directly or indirectly, in violation of such export laws. Use of the word “partner” in reference to ARM’s customers is not intended to create or refer to any partnership relationship with any other company. ARM may make changes to this document at any time and without notice. If any of the provisions contained in these terms conflict with any of the provisions of any signed written agreement covering this document with ARM, then the signed written agreement prevails over and supersedes the conflicting provisions of these terms. This document may be translated into other languages for convenience, and you agree that if there is any conflict between the English version of this document and any translation, the terms of the English version of the Agreement shall prevail. Words and logos marked with ® or ™ are registered trademarks or trademarks of ARM Limited or its affiliates in the EU and/or elsewhere. All rights reserved. Other brands and names mentioned in this document may be the trademarks of their respective owners. Please follow ARM’s trademark usage guidelines at http://www.arm.com/about/trademark-usage-guidelines.php Copyright © [2007, 2008, 2011, 2012, 2014, 2015], ARM Limited or its affiliates. All rights reserved.

ARM DUI0379G

Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved. Non-Confidential

2

ARM® Compiler v5.06 for µVision® ARM Limited. Company 02557590 registered in England. 110 Fulbourn Road, Cambridge, England CB1 9NJ. LES-PRE-20349 Confidentiality Status This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in accordance with the terms of the agreement entered into by ARM and the party that ARM delivered this document to. Unrestricted Access is an ARM internal classification. Product Status The information in this document is Final, that is for a developed product. Web Address http://www.arm.com

ARM DUI0379G

Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved. Non-Confidential

3

Contents ARM® Compiler v5.06 for µVision® armasm User Guide

Preface About this book ..................................................... ..................................................... 20

Chapter 1

Overview of the Assembler 1.1 1.2 1.3 1.4

Chapter 2

ARM DUI0379G

About the ARM Compiler toolchain assemblers ...................................................... Key features of the assembler ........................................ ........................................ How the assembler works ........................................... ........................................... Directives that can be omitted in pass 2 of the assembler ......................................

1-23 1-24 1-25 1-27

Overview of the ARM Architecture 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10

About the ARM architecture .......................................... .......................................... 2-30 ARM, Thumb, and ThumbEE instruction sets ............................ ............................ 2-31 Changing between ARM, Thumb, and ThumbEE state ..................... ..................... 2-32 Processor modes, and privileged and unprivileged software execution .................. 2-33 Processor modes in ARMv6-M and ARMv7-M ........................... ........................... 2-34 VFP hardware .......................................................................................................... 2-35 ARM registers .......................................................................................................... 2-36 General-purpose registers ........................................... ........................................... 2-38 Register accesses ................................................. ................................................. 2-39 Predeclared core register names ...................................... ...................................... 2-40

2.11 2.12

Predeclared extension register names .................................................................... 2-41 Predeclared coprocessor names ...................................... ...................................... 2-42

Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved. Non-Confidential

4

2.13 2.14 2.15 2.16 2.17 2.18 2.19

Chapter 3

About the Unified Assembler Language .................................................................. 4-58 Register usage in subroutine calls ..................................... ..................................... 4-59 Load immediate values ............................................................................................ 4-60 Load immediate values using MOV and MVN ............................ ............................ 4-61 Load immediate values using MOV32 .................................. .................................. 4-64 Load immediate values using LDR Rd, =const ........................... ........................... 4-65 Literal pools ...................................................... ...................................................... 4-66 Load addresses into registers ........................................ ........................................ 4-68 Load addresses to a register using ADR ................................ ................................ 4-69 Load addresses to a register using ADRL ............................... ............................... 4-71 Load addresses to a register using LDR Rd, =label ................................................ 4-72 Other ways to load and store registers .................................................................... 4-74 Load and store multiple register instructions ............................. ............................. 4-75 Load and store multiple register instructions in ARM and Thumb ............. ............. 4-76 Stack implementation using LDM and STM .............................. .............................. 4-77 Stack operations for nested subroutines ................................ ................................ 4-79 Block copy with LDM and STM ................................................................................ 4-80 Memory accesses .................................................................................................... 4-82 The Read-Modify-Write operation ..................................... ..................................... 4-83 Optional hash with immediate constants ................................ ................................ 4-84 Use of macros .................................................... .................................................... 4-85 Test-and-branch macro example ...................................... ...................................... 4-86 Unsigned integer division macro example ............................... ............................... 4-87 Instruction and directive relocations ........................................................................ 4-89 Frame directives ...................................................................................................... 4-91 Exception tables and Unwind tables ........................................................................ 4-92 Assembly language changes after RVCT v2.1 ........................................................ 4-93

Condition Codes 5.1 5.2 5.3 5.4 5.5 5.6

ARM DUI0379G

Syntax of source lines in assembly language .......................................................... 3-51 Literals .......................................................... .......................................................... 3-53 ELF sections and the AREA directive ...................................................................... 3-54 An example ARM assembly language module ........................................................ 3-55

Writing ARM Assembly Language 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 4.12 4.13 4.14 4.15 4.16 4.17 4.18 4.19 4.20 4.21 4.22 4.23 4.24 4.25 4.26 4.27

Chapter 5

2-43 2-44 2-45 2-46 2-47 2-48 2-49

Structure of Assembly Language Modules 3.1 3.2 3.3 3.4

Chapter 4

Program Counter .................................................. .................................................. Application Program Status Register ................................... ................................... The Q flag ................................................................................................................ Current Program Status Register ............................................................................ Saved Program Status Registers ............................................................................ ARM and Thumb instruction set overview ............................... ............................... Access to the inline barrel shifter ...................................... ......................................

Conditional instructions ............................................. ............................................. 5-96 Conditional execution in ARM state .................................... .................................... 5-97 Conditional execution in Thumb state .................................. .................................. 5-98 Updates to the condition flags ........................................ ........................................ 5-99 Condition code suffixes and related flags .............................................................. 5-100 Comparison of condition code meanings in integer and floating-point code .... .... 5-101

Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved. Non-Confidential

5

5.7 5.8 5.9

Chapter 6

Using the Assembler 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 6.10 6.11 6.12 6.13 6.14 6.15 6.16 6.17

Chapter 7

armasm command-line syntax ....................................... ....................................... 6-109 Specify command-line options with an environment variable ................................ 6-110 Using stdin to input source code to the assembler ........................ ........................ 6-111 Built-in variables and constants ...................................... ...................................... 6-112 Identifying versions of armasm in source code ...................................................... 6-116 Diagnostic messages .............................................. .............................................. 6-117 Interlocks diagnostics .............................................. .............................................. 6-118 Automatic IT block generation ....................................... ....................................... 6-119 Thumb branch target alignment ...................................... ...................................... 6-120 Thumb code size diagnostics ................................................................................ 6-121 ARM and Thumb instruction portability diagnostics ....................... ....................... 6-122 Instruction width diagnostics .................................................................................. 6-123 Two pass assembler diagnostics ..................................... ..................................... 6-124 Conditional assembly .............................................. .............................................. 6-125 Using the C preprocessor ...................................................................................... 6-126 Address alignment ................................................ ................................................ 6-128 Instruction width selection in Thumb .................................. .................................. 6-129

Symbols, Literals, Expressions, and Operators 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.10 7.11 7.12 7.13 7.14 7.15 7.16 7.17 7.18 7.19 7.20 7.21 7.22 7.23 7.24 7.25 7.26

ARM DUI0379G

Benefits of using conditional execution ................................ ................................ 5-103 Example showing the benefits of using conditional instructions ............................ 5-104 Optimization for execution speed .......................................................................... 5-107

Symbol naming rules .............................................. .............................................. 7-132 Variables ................................................................................................................ 7-133 Numeric constants ................................................ ................................................ 7-134 Assembly time substitution of variables ................................ ................................ 7-135 Register-relative and PC-relative expressions ........................... ........................... 7-136 Labels .................................................................................................................... 7-137 Labels for PC-relative addresses ..................................... ..................................... 7-138 Labels for register-relative addresses ................................. ................................. 7-139 Labels for absolute addresses ....................................... ....................................... 7-140 Numeric local labels ............................................... ............................................... 7-141 Syntax of numeric local labels ....................................... ....................................... 7-142 String expressions ................................................ ................................................ 7-143 String literals .......................................................................................................... 7-144 Numeric expressions .............................................. .............................................. 7-145 Syntax of numeric literals ........................................... ........................................... 7-146 Syntax of floating-point literals ....................................... ....................................... 7-147 Logical expressions ............................................... ............................................... 7-148 Logical literals ........................................................................................................ 7-149 Unary operators .................................................. .................................................. 7-150 Binary operators .................................................................................................... 7-151 Multiplicative operators .......................................................................................... 7-152 String manipulation operators ................................................................................ 7-153 Shift operators ................................................... ................................................... 7-154 Addition, subtraction, and logical operators ............................. ............................. 7-155 Relational operators ............................................... ............................................... 7-156 Boolean operators ................................................ ................................................ 7-157

Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved. Non-Confidential

6

7.27 7.28

Chapter 8

VFP Programming 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 8.10 8.11 8.12 8.13 8.14 8.15 8.16 8.17 8.18 8.19 8.20 8.21 8.22 8.23 8.24 8.25 8.26

Chapter 9

Architecture support for VFP ........................................ ........................................ 8-163 Half-precision extension for VFP ..................................... ..................................... 8-164 Fused Multiply-Add extension for VFP .................................................................. 8-165 Extension register bank mapping in VFP ............................... ............................... 8-166 VFP views of the extension register bank .............................. .............................. 8-168 Load values to VFP registers ........................................ ........................................ 8-169 Conditional execution of VFP instructions .............................. .............................. 8-170 Floating-point exceptions in VFP ............


Similar Free PDFs