ARM® Developer Suite Version 1.2 Assembler Guide Copyright ©2000, 2001 ARM Limited. All rights reserved. ARM DUI 0068B ARM Developer Suite Assembler Guide Copyright ©2000, 2001 ARM Limited. All rights reserved. Release Information The following changes have been made to this book. Change History Date Issue Change November 2000 A Release 1.1 November 2001 B Release 1.2 Proprietary Notice Words and logos marked with ® or ™ are registered trademarks or trademarks owned by ARM Limited. Other brands and names mentioned herein may be the trademarks of their respective owners. Neither the whole nor any part of the information contained in, or the product described in, this document may be adapted or reproduced in any material form except with the prior written permission of the copyright holder. The product described in this document is subject to continuous developments and improvements. All particulars of the product and its use contained in this document are given by ARM in good faith. However, all warranties implied or expressed, including but not limited to implied warranties of merchantability, or fitness for purpose, are excluded. This document is intended only to assist the reader in the use of the product. ARM Limited shall not be liable for any loss or damage arising from the use of any information in this document, or any error or omission in such information, or any incorrect use of the product. ii Copyright ©2000, 2001 ARM Limited. All rights reserved. ARM DUI 0068B Contents ARM Developer Suite Assembler Guide Preface About this book .............................................................................................. vi Feedback ....................................................................................................... ix Chapter1 Introduction 1.1 About the ARM Developer Suite assemblers .............................................. 1-2 Chapter2 Writing ARM and Thumb Assembly Language 2.1 Introduction ................................................................................................. 2-2 2.2 Overview of the ARM architecture .............................................................. 2-3 2.3 Structure of assembly language modules ................................................. 2-12 2.4 Using the C preprocessor ......................................................................... 2-19 2.5 Conditional execution ................................................................................ 2-20 2.6 Loading constants into registers ............................................................... 2-25 2.7 Loading addresses into registers .............................................................. 2-30 2.8 Load and store multiple register instructions ............................................. 2-39 2.9 Using macros ............................................................................................ 2-48 2.10 Describing data structures with MAP and FIELD directives ...................... 2-51 2.11 Using frame directives ............................................................................... 2-66 Chapter3 Assembler Reference 3.1 Command syntax ........................................................................................ 3-2 ARM DUI 0068B Copyright ©2000, 2001 ARM Limited. All rights reserved. iii Contents 3.2 Format of source lines ................................................................................ 3-8 3.3 Predefined register and coprocessor names .............................................. 3-9 3.4 Built-in variables ....................................................................................... 3-10 3.5 Symbols .................................................................................................... 3-12 3.6 Expressions, literals, and operators ......................................................... 3-18 Chapter4 ARM Instruction Reference 4.1 Conditional execution ................................................................................. 4-4 4.2 ARM memory access instructions .............................................................. 4-6 4.3 ARM general data processing instructions ............................................... 4-23 4.4 ARM multiply instructions ......................................................................... 4-39 4.5 ARM saturating arithmetic instructions ..................................................... 4-55 4.6 ARM branch instructions .......................................................................... 4-57 4.7 ARM coprocessor instructions .................................................................. 4-62 4.8 Miscellaneous ARM instructions ............................................................... 4-71 4.9 ARM pseudo-instructions ......................................................................... 4-78 Chapter5 Thumb Instruction Reference 5.1 Thumb memory access instructions ........................................................... 5-4 5.2 Thumb arithmetic instructions ................................................................... 5-15 5.3 Thumb general data processing instructions ............................................ 5-22 5.4 Thumb branch instructions ....................................................................... 5-31 5.5 Thumb software interrupt and breakpoint instructions .............................. 5-37 5.6 Thumb pseudo-instructions ...................................................................... 5-39 Chapter6 Vector Floating-point Programming 6.1 The vector floating-point coprocessor ........................................................ 6-4 6.2 Floating-point registers ............................................................................... 6-5 6.3 Vector and scalar operations ...................................................................... 6-7 6.4 VFP and condition codes ............................................................................ 6-8 6.5 VFP system registers ............................................................................... 6-10 6.6 Flush-to-zero mode .................................................................................. 6-13 6.7 VFP instructions ....................................................................................... 6-15 6.8 VFP pseudo-instruction ............................................................................ 6-38 6.9 VFP directives and vector notation ........................................................... 6-40 Chapter7 Directives Reference 7.1 Alphabetical list of directives ...................................................................... 7-2 7.2 Symbol definition directives ........................................................................ 7-3 7.3 Data definition directives .......................................................................... 7-13 7.4 Assembly control directives ...................................................................... 7-26 7.5 Frame description directives ..................................................................... 7-33 7.6 Reporting directives .................................................................................. 7-44 7.7 Miscellaneous directives ........................................................................... 7-49 Glossary iv Copyright ©2000, 2001 ARM Limited. All rights reserved. ARM DUI 0068B Preface This preface introduces the documentation for the ARM Developer Suite (ADS) assemblers and assembly language. It contains the following sections: (cid:127) About this book on pagevi (cid:127) Feedback on pageix. ARM DUI 0068B Copyright ©2000, 2001 ARM Limited. All rights reserved. v Preface About this book This book provides tutorial and reference information for the ADS assemblers (armasm, the free-standing assembler, and inline assemblers in the C and C++ compilers). It describes the command-line options to the assembler, the pseudo-instructions and directives available to assembly language programmers, and the ARM, Thumb®, and Vector Floating-point (VFP) instruction sets. Intended audience This book is written for all developers who are producing applications using ADS. It assumes that you are an experienced software developer and that you are familiar with the ARM development tools as described in ADS Getting Started. Using this book This book is organized into the following chapters: Chapter1 Introduction Read this chapter for an introduction to the ADS version 1.2 assemblers and assembly language. Chapter2 Writing ARM and Thumb Assembly Language Read this chapter for tutorial information to help you use the ARM assemblers and assembly language. Chapter3 Assembler Reference Read this chapter for reference material about the syntax and structure of the language provided by the ARM assemblers. Chapter4 ARM Instruction Reference Read this chapter for reference material on the ARM instruction set. Chapter5 Thumb Instruction Reference Read this chapter for reference material on the Thumb instruction set. Chapter6 Vector Floating-point Programming Read this chapter for reference material on the VFP instruction set, and other VFP-specific assembly language information. Chapter7 Directives Reference Read this chapter for reference material on the assembler directives available in the ARM assembler, armasm. vi Copyright ©2000, 2001 ARM Limited. All rights reserved. ARM DUI 0068B Preface Typographical conventions The following typographical conventions are used in this book: monospace Denotes text that can be entered at the keyboard, such as commands, file and program names, and source code. monospace Denotes a permitted abbreviation for a command or option. The underlined text can be entered instead of the full command or option name. monospace italic Denotes arguments to commands and functions where the argument is to be replaced by a specific value. monospace bold Denotes language keywords when used outside example code. italic Highlights important notes, introduces special terminology, denotes internal cross-references, and citations. bold Highlights interface elements, such as menu names. Also used for emphasis in descriptive lists, where appropriate, and for ARM processor signal names. Further reading This section lists publications from both ARM Limited and third parties that provide additional information on developing code for the ARM family of processors. ARM periodically provides updates and corrections to its documentation. See http://www.arm.com for current errata sheets and addenda. See also the ARM Frequently Asked Questions list at: http://www.arm.com/DevSupp/Sales+Support/faq.html ARM publications This book contains reference information that is specific to development tools supplied with ADS. Other publications included in the suite are: (cid:127) ADS Installation and License Management Guide (ARM DUI 0139) (cid:127) Getting Started (ARM DUI 0064) (cid:127) ADS Compilers and Libraries Guide (ARM DUI 0067) ARM DUI 0068B Copyright ©2000, 2001 ARM Limited. All rights reserved. vii Preface (cid:127) ADS Linker and Utilities Guide (ARM DUI 0151) (cid:127) CodeWarrior IDE Guide (ARM DUI 0065) (cid:127) AXD and armsd Debuggers Guide (ARM DUI 0066) (cid:127) ADS Debug Target Guide (ARM DUI 0058) (cid:127) ADS Developer Guide (ARM DUI 0056) (cid:127) ARM Applications Library Programmer’s Guide (ARM DUI 0081). The following additional documentation is provided with the ARM Developer Suite: (cid:127) ARM Architecture Reference Manual (ARM DDI 0100). This is supplied in DynaText format as part of the online books, and in PDF format in install_directory\PDF\ARM-DDI0100B_armarm.pdf. (cid:127) ARM ELF specification (SWS ESPC 0003). This is supplied in PDF format in install_directory\PDF\specs\ARMELF.pdf. (cid:127) TIS DWARF 2 specification. This is supplied in PDF format in install_directory\PDF\specs\TIS-DWARF2.pdf. (cid:127) ARM/Thumb Procedure Call Specification (SWS ESPC 0002). This is supplied in PDF format in install_directory\PDF\specs\ATPCS.pdf. In addition, refer to the following documentation for specific information relating to ARM products: (cid:127) ARM Reference Peripheral Specification (ARM DDI 0062) (cid:127) the ARM datasheet or technical reference manual for your hardware device. Other publications The following book gives general information about the ARM architecture: (cid:127) ARM System-on-chip Architecture, Furber, S., (2nd Edition, 2000). Addison Wesley Longman, Harlow, England. ISBN 0-201-67519-6. viii Copyright ©2000, 2001 ARM Limited. All rights reserved. ARM DUI 0068B Preface Feedback ARM Limited welcomes feedback on both ADS and the documentation. Feedback on the ARM Developer Suite If you have any problems with ADS, please contact your supplier. To help them provide a rapid and useful response, please give: (cid:127) your name and company (cid:127) the serial number of the product (cid:127) details of the release you are using (cid:127) details of the platform you are running on, such as the hardware platform, operating system type and version (cid:127) a small standalone sample of code that reproduces the problem (cid:127) a clear explanation of what you expected to happen, and what actually happened (cid:127) the commands you used, including any command-line options (cid:127) sample output illustrating the problem (cid:127) the version string of the tools, including the version number and build numbers. Feedback on this book If you have any problems with this book, please send email to [email protected] giving: (cid:127) the document title (cid:127) the document number (cid:127) the page number(s) to which your comments apply (cid:127) a concise explanation of the problem. General suggestions for additions and improvements are also welcome. ARM DUI 0068B Copyright ©2000, 2001 ARM Limited. All rights reserved. ix Preface x Copyright ©2000, 2001 ARM Limited. All rights reserved. ARM DUI 0068B
Description: