ARM Software Development Toolkit Version 2.11 User Guide
Total Page:16
File Type:pdf, Size:1020Kb
211ug.book : SDT_UG_Front_cover.fm Page i Sunday, June 1, 1997 12:21 PM ARM Software Development Toolkit Version 2.11 User Guide Document number: ARM DUI 0040C Issued: May 1997 Copyright Advanced RISC Machines Ltd (ARM) 1996 Beta Draft Beta ENGLAND GERMANY Advanced RISC Machines Limited Advanced RISC Machines Limited Fulbourn Road Otto-Hahn Str. 13b Cherry Hinton 85521 Ottobrunn-Riemerling Cambridge CB1 4JN Munich UK Germany Telephone: +44 1223 400400 Telephone: +49 89 608 75545 Facsimile: +44 1223 400410 Facsimile: +49 89 608 75599 Email: [email protected] Email: [email protected] JAPAN USA Advanced RISC Machines K.K. ARM USA Incorporated KSP West Bldg, 3F 300D, 3-2-1 Sakado Suite 5 Takatsu-ku, Kawasaki-shi 985 University Avenue Kanagawa Los Gatos 213 Japan CA 95030 USA Telephone: +81 44 850 1301 Telephone: +1 408 399 5199 Facsimile: +81 44 850 1308 Facsimile: +1 408 399 8854 Email: [email protected] Email: [email protected] World Wide Web address: http://www.arm.com Partner Confidential - Final Draft 211ug.book : SDT_UG_Front_cover.fm Page ii Sunday, June 1, 1997 12:21 PM Proprietary Notice ARM, the ARM Powered logo and EmbeddedICE are trademarks of Advanced RISC Machines Ltd. Neither the whole nor any part of the information contained in, or the product described in, this manual may be adapted or reproduced in any material form except with the prior written permission of the copyright holder. The product described in this manual is subject to continuous developments and improvements. All particulars of the product and its use contained in this manual are given by ARM in good faith. However, all warranties implied or expressed, including but not limited to implied warranties or merchantability, or fitness for purpose, are excluded. This manual is intended only to assist the reader in the use of the product. ARM Ltd shall not be liable for any loss or damage arising from the use of any information in this manual, or any error or omission in such information, or any incorrect use of the product. Change Log Issue Date By Change A-xx November 1996 JS Updated for Beta Test A December 1996 Doc Group Final draft B January 1997 JS Review comments added C May 1997 paw general update Beta Draft ii User Guide ARM DUI 0040C 211ug.book : Preface.fm Page 1 Sunday, June 1, 1997 12:21 PM Preface About This Manual Preface-2 Feedback Preface-3 User Guide Preface-1 ARM DUI 0040C 211ug.book : Preface.fm Page 2 Sunday, June 1, 1997 12:21 PM Preface About This Manual Overview This manual describes the ARM Software Development Toolkit (SDT), a suite of applications which, together with supporting documentation and examples, enables you to write and debug applications for the ARM family of RISC processors. Typographical Conventions The following typographical conventions are used in this book: typewriter denotes text that may be entered at the keyboard: commands, file and program names, and C source typewriter-italic shows text that must be submitted with user-supplied information: this is most often used in syntax descriptions italic highlights important notes and ARM-specific terminology bold signal names and menu selections bold internal cross-references Preface-2 User Guide ARM DUI 0040C 211ug.book : Preface.fm Page 3 Sunday, June 1, 1997 12:21 PM Preface Feedback Feedback on this manual If you have any comments or suggestions about this document, please contact your supplier giving: • the document title • the document number • the page number(s) to which your comments refer • a concise explanation of your comments Feedback on the Software Development Toolkit If you have any problems with the Software Development Toolkit, please contact your supplier including the following information: • details of the version of tools you are using, and the host system • a small sample code fragment that reproduces the problem • a clear explanation of what you expected to happen, and what actually happened User Guide Preface-3 ARM DUI 0040C 211ug.book : Preface.fm Page 4 Sunday, June 1, 1997 12:21 PM Preface Preface-4 User Guide ARM DUI 0040C 211ug.book : 211ugTOC.fm Page 1 Sunday, June 1, 1997 12:21 PM Contents 1 Introduction 1-1 1.1 Introduction to the ARM Software Development Toolkit 1-2 1.2 Components of the SDT 1-3 1.3 What’s New 1-5 2 ARM Project Manager 2-1 2.1 Introduction 2-2 2.2 APM Concepts 2-3 2.3 The APM Desktop 2-9 2.4 Getting Started 2-13 2.5 Additional APM Functions 2-20 2.6 Project Manager Configuration 2-26 2.7 Working with Source Files 2-28 2.8 Viewing Object and Executable Files 2-31 2.9 Working with Project Templates 2-33 2.10 Build Step Patterns 2-41 3 ARM Debugger for Windows 3-1 3.1 Introduction 3-2 User Guide Contents-1 ARM DUI 0040C 211ug.book : 211ugTOC.fm Page 2 Sunday, June 1, 1997 12:21 PM Contents 3.2 Debugging an ARM Application 3-3 3.3 Debugging Systems 3-3 3.4 ADW Concepts 3-6 3.5 The ADW Desktop 3-11 3.6 Getting Started 3-21 3.7 Debugger Configuration 3-28 3.8 Displaying Image Information 3-34 3.9 Setting and Editing Complex Breakpoints and Watchpoints 3-39 3.10 Other Debugging Functions 3-42 4 Command-Line Development 4-1 4.1 Introduction 4-2 4.2 The Hello World Example 4-2 4.3 armsd 4-7 5 The ARMulator 5-1 5.1 What is the ARMulator? 5-2 5.2 Models 5-2 5.3 Rebuilding the ARMulator 5-4 5.4 ARMulator facilities 5-6 5.5 Supplied Models: Angel 5-9 5.6 Supplied Models: Dummy MMU 5-11 5.7 Supplied Models: Profiler 5-12 5.8 Supplied Models: Tracer 5-13 5.9 Supplied Models: Watchpoints 5-15 5.10 Supplied Models: Windows Hourglass 5-15 5.11 Supplied Models: Page Table Manager 5-15 5.12 An Example Memory Model 5-17 6 Angel 6-1 6.1 Introduction 6-2 6.2 Overview of Developing Applications with Angel 6-4 6.3 Inside Angel 6-9 6.4 Angel System Features 6-12 6.5 Debuggers 6-16 6.6 Minimal Angel 6-17 6.7 Porting Angel to New Hardware 6-18 6.8 Downloading a Debug Agent 6-21 6.9 Adding a Channel 6-22 6.10 Using Angel on the ARM PID7T board 6-23 6.11 Using Angel on the ARM60 PIE Board or ARM7 PIE Board6-26 6.12 The Debug Comms Channel, Angel, and EmbeddedICE 6-27 6.13 Notes for Demon Users 6-29 6.14 Example of an Application Device using Angel (UNIX only) 6-31 Contents-2 User Guide ARM DUI 0040C 211ug.book : 211ugTOC.fm Page 3 Sunday, June 1, 1997 12:21 PM Contents 7 EmbeddedICE 7-1 7.1 What is EmbeddedICE? 7-2 7.2 The Effect of EmbeddedICE on the Debuggee 7-5 7.3 Connecting and Powering Up 7-6 7.4 Configuring EmbeddedICE to Match your Target Core 7-7 7.5 Configuring the Debugger 7-9 7.6 Watchpoints and Breakpoints 7-13 7.7 Vector Breakpoints and Exceptions 7-15 7.8 Semihosting 7-17 7.9 Reset and JTAG Signal Connection 7-20 7.10 Debugging Applications in ROM 7-24 7.11 Accessing the EmbeddedICE Macrocell Directly 7-28 7.12 EmbeddedICE and Target Board Memory Layout 7-30 7.13 Timer Accuracy 7-32 7.14 Floating-Point and Other Coprocessors 7-39 8 Benchmarking, Performance Analysis and Profiling 8-1 8.1 Introduction 8-2 8.2 Measuring Code and Data Size 8-3 8.3 Performance Benchmarking 8-6 8.4 Improving Performance and Code Size 8-14 8.5 Profiling 8-19 9 Basic Assembly Language Programming 9-1 9.1 Introduction 9-2 9.2 Structure of an ARM Assembler Module 9-5 9.3 Assembler Subroutines 9-7 9.4 Structure of a Thumb Assembler Module 9-8 9.5 Loading Constants into Registers 9-10 9.6 Conditional Execution 9-14 9.7 Loading Addresses into Registers 9-19 9.8 Calling Assembler from C 9-25 9.9 Load and Store Multiple Registers Instructions 9-27 10 Using the Procedure Call Standards 10-1 10.1 Introduction 10-2 10.2 Using APCS 10-3 10.3 Using the Thumb Procedure Call Standard 10-9 10.4 Passing and Returning Structures 10-11 11 Exception Handling 11-1 11.1 Overview 11-2 11.2 Entering and Leaving an Exception 11-5 11.3 The Return Address and Return Instruction 11-6 User Guide Contents-3 ARM DUI 0040C 211ug.book : 211ugTOC.fm Page 4 Sunday, June 1, 1997 12:21 PM Contents 11.4 Installing an Exception Handler 11-8 11.5 SWI Handlers 11-12 11.6 Interrupt Handlers 11-19 11.7 Reset Handlers 11-25 11.8 Undefined Instruction Handlers 11-26 11.9 Prefetch Abort Handler 11-27 11.10 Data Abort Handler 11-28 11.11 Chaining Exception Handlers 11-29 11.12 Additional Considerations on Thumb-Aware Processors 11-31 11.13 System Mode 11-35 12 Interworking ARM and Thumb 12-1 12.1 Introduction 12-2 12.2 Basic Assembler Interworking 12-4 12.3 C Interworking and Veneers 12-10 12.4 Assembler Interworking Using Veneers 12-18 12.5 Interworking and the ARM Project Manager 12-21 12.6 Using the Thumb-ARM Interworking Image Project 12-22 12.7 Modifying Project to Support Interworking 12-24 12.8 Library usage and the ARM Project Manager 12-25 13 Writing code for ROM 13-1 13.1 Introduction 13-2 13.2 Application Startup 13-3 13.3 The Embedded C Library 13-16 13.4 Troubleshooting Hints and Tips 13-24 14 Placing Code and Data in Memory 14-1 14.1 Introduction 14-2 14.2 Scatter Loading 14-3 14.3 Overlays 14-15 14.4 Overlays using Scatter Loading 14-28 15 Floating-Point Support 15-1 15.1 Introduction 15-2 15.2 The ARM Floating-point Library 15-3 15.3 Floating-Point Instructions 15-8 15.4 Linking the FPE into an Application 15-13 15.5 Configuring the FPA Support Code/FPE for a New Environment 15-14 15.6 Controlling Floating-Point Exceptions 15-15 Contents-4 User Guide ARM DUI 0040C 211ug.book : 01_overview.fm Page 1 Sunday, June 1, 1997 12:21 PM 1 Introduction 1.1 Introduction to the ARM Software Development Toolkit 1-2 1.2 Components of the SDT 1-3 1.3.2 What was new in SDT 2.10 1-5 User Guide 1-1 ARM DUI 0040C 211ug.book : 01_overview.fm Page 2 Sunday, June 1, 1997 12:21 PM Introduction 1.1 Introduction to the ARM Software Development Toolkit The ARM Software Development Toolkit (SDT) consists of a suite of applications, together with supporting documentation and examples, that enable you to write and debug applications for ‘the’ ARM family of RISC cores.