0% found this document useful (0 votes)
1K views

Arm Assembly Language PDF Free

Assembly Language arm 7 lpc 2148

Uploaded by

Madhu C K
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
1K views

Arm Assembly Language PDF Free

Assembly Language arm 7 lpc 2148

Uploaded by

Madhu C K
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 383
SECOND EDITION ARM ASSEMBLY. LANGUAGE* “| Fundamentals and Techniques) CRC Press Taylor & Francis Group {6000 Broken Sound Parkway NW, Suite 300 Boca Raton, FL 33487-2742 © 2015 by William Hohl and Christopher Hinds CRC Press is an imprint of Taylor & Francis Group, an Informa business No claim to original U.S. Government works Printed on acid-free paper ‘Version Date: 20140915, International Standard Book Number-13: 978-1-4822-2985-1 (Hardback) ‘This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any Future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmit- ted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, ‘without written permission from the publishers. For permission to photocopy or use material electronically from this work, please access www.copyright. com (http://www-copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood. Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and. registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged. ‘Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used ‘only for identification and explanation without intent to infringe. Library of Congress Cataloging-in-Publication Data Hohl, William. ARM assembly language : fundamentals and techniques / William Hohl and Christopher Hinds. -- Second edition. pages cm. Includes bibliographical references and index. ISBN 978-1-4822-2985-1 (hardback) 1. Assembly languages (Electronic computers) 2. Embedded computer systems--Programming, I. Hinds, Christopher. Il. Title. (QA76.73.A8H637 2014 006.2°2--de23 2014024230 it the Taylor & Francis Web hetp://www-taylorandfrancis.com and the CRC Press Web site at http://eww.crepress.com Contents Preface... Authors. Chapter 1 Chapter 2 An Overview of Computing Systems 1 LL 12 16 LT 18 The Programmer's Model Rep bie Introduction... History of RISC. 1.2.1 ARM Begins The Creation of ARM Ltd ARM Today The Cortex Family .... 1.2.4.1 The Cortex-A and Cortex-R Families. 1.2.4.2 The Cortex-M Family. The Computing Device... Number Systems. Representations of Numbers and Character 15.1 Integer Representations. 1.5.2. Floating-Point Representations 1.5.3. Character Representations. Translating Bits to Commands The Tools. 1.7.1 Open Sour 1.7.2 Keil (ARM) 1.7.3 Code Composer Studio 1.7.4 Useful Documentation. Exercises... Too! Introduction Data Types... ARM7TDMI..... 2.3.1 Processor Modes .. 2.3.2 Registers 3. The Vector Table Cortex M4. 2.4.1 Processor Modes .. 2.4.2 Registers. The Vector Table Exercises. vii Contents Chapter 3 Introduction to Instruction Sets: y4T and v7-M. 3.1 Introduction ... - 3.2. ARM, Thumb, and Thumb-2 Instructions 3.3. Program 1: Shifting Data... 3.3.1 Running the Code 3 3.3.2 Examining Register and Memory Contents 49 3.4 Program 2: Factorial Calculation 3.5. Program 3: Swapping Register Contents 3.6 Program 4: Playing with Floating-Point Number 3.7 Program 5: Moving Values between Integer and Floating Point Registers... 3.8 Programming Guidelines . 3.9 Exercises... os Chapter 4 Assembler Rules and Directives... roduction .. 4.2 Structure of Assembly Language Modules 4.3. Predefined Register Names 4.4 Frequently Used Directives 4.4.1 Defining a Block of Data or Code 44.1.1 Keil Tools. sass 4.4.1.2 Code Composer Studio Tool: 4.4.2 Register Name Definition 44.2.1 Keil Tools. 4.4.2.2 Code Composer Studio. 4.4.3 Equating a Symbol to a Numeric Constant 43.1 Keil Tools.. 44.3.2 Code Composer 4.4.4 Declaring an Entry Point... 4.4.5 Allocating Memory and Specifying Contents 44.5.1 Keil Tools. 4.4.5.2 Code Composer Studio. 4.46 — Aligning Data or Code to Appropri 4.4.6.1 Keil Tools.. 44.6.2 Code Composer Studio 4.4.7 Reserving a Block of Memory 44.7.1 Keil Tools.. 4.4.7.2 Code Composer Studio. 448 — Assigning Literal Pool Origins . 4.4.9 Ending a Source File 45 Macros iscellaneous Assembler Features Assembler Operators ...... 4.6.2. Math Functions in CCS... 4.7 Exercises tudio., Contents Chapter § Chapter 6 Chapter 7 Loads, Stores, and Addressing 3 52 53 54 Constants and Literal Pools..... 6.1 6.2 63 64 65 6.6 Integer Logic and Arithmetic... Td 72 13. 14 Introduction ... Memory .. Loads and Stores: The Instructions. Operand Addressing 5.4.1 Pre-Indexed Addressing 5.4.2 Post-Indexed Addressing Endiannes 5.5.1 Changing Endiannes 5.5.2 Defining Memory Areas Bit-Banded Memory .... Memory Considerations Exercises... Introduction ... ” sana The ARM Rotation Scheme... Loading Constants into Registers. Loading Constants with MOVW, MOVT...... Loading Addresses into Registers Exercises Introduction ... Flags and Their Use. 7.2.1 The NF The V Fla; The Z Fla 7.24 The C Flag. Comparison Instructions Data Processing Operations .. 7.4.1 Boolean Operations 7.4.2 — Shifts and Rotates. 7.4.3 Addition/Subtraction 7.44 Saturated Math Operations 7.45 Multiplication . z ' 5 7.46 Multiplication by a Constant. 139 7.4.7 Division DSP Extensions .. Bit Manipulation Instructions Fractional Notation. Exercises Chapter 8 Branches and Loops Chapter 9 8.1 8.2 84 8.5 8.6 Introduction to Floating-Point: Basi and Data Transfer... x1 9.2 93 o4 a5 96 7 98 99 9.10 OAL Contents Introduction ... Branching .. 8.2.1 Branching (ARM7TDMD).. 8.2.2. Version 7-M Branches. Looping. 8.3.1 While Loop xecution. 8.4.2 \7-M Conditional Execution: The IT Block Straight-Line Codin, Exercises... Data Types, 175 175, 175 Introduction .. A Brief History of Floating-Point in Computing . ‘The Contribution of Floating-Point to the Embedded Processor Floating-Point Data Types The Space of Floating-Point Representable Valu Floating-Point Representable Values... 9.6.1 Normal Values. 9.6.2. Subnormal Values 9.6.3 Zeros.... 9.6.4 Infinities.. 9.6.5 Not-a-Numbers (NaNs) The Floating-Point Register File of the Cortex-M4.... FPU Control Registers 9.8.1 The Floating-Point Status and Control Register, FPSCR... 98.1.1 The Control and Mode Bits 194 9.8.1.2 The Exception Bits. 9.8.2 The Coprocessor Access Control Register, CPACR... . Loading Data into Floating-Point Registers .....:00:esee-n 197 9.9.1 Floating-Point Loads and Stores: The Instructions. 9.9.2 The VMOV instruction Conversions between Half-Precision and Single-Precision......201 Conversions to Non-Floating-Point Formats, 9.11.1 Conversions between Integer and Floating-Point. 178 180 183, 185, 188 193 Contents 9.12 Chapter 10 Introduction to Floating-Point: Rounding and Exceptions.. 10.1 10.2 10.4 10.5 10.6 xi 9.11.2 Conversions between Fixed-Point and Floating-Point Exercises ; Introduction .. Rounding ... 10.2.1 Introduction to Rounding Modes in the IEEE 754-2008 Specification... The roundTiesToEven (RNE) Rounding Mode. The Directed Rounding Mode: 10.2.3.1 The roundTowardPositive (RP) Rounding Mode 215 10.2.3.2. The round TowardNegative (RM) Rounding Mode... 10.2.3.3. The roundTowardZero (RZ) Rounding Moe... 10.2.4 Rounding Mode Summary.. Exceptions . 10.3.1 Introduction to Floating-Point Exception: Exception Handling. Division by Zero. Invalid Operation Overflow Underflow... 10.3.7 Inexact Result Algebraic Laws and Floating-Point Normalization and Cancelation.... Exercises... Chapter 11 Floating-Point Data-Processing Instructions . 235 1S Introduction ... Floating-Point Data-Processing Instruction Syntax... Instruction Summary Flags and Their Use... L141 Comparison Instructions 114.2. The N Flag 114.3. The Z Flag 1144 TheCF 114.5. The V Fla 11.4.6 Predicated Instructions, or the Use of the Flags 11.4.7 A Word about the IT Instruction... ‘Two Special Modes... 11.5.1 Flush-to-Zero Mode

You might also like