ARM Software Development Toolkit Version 2.50 User Guide Copyright ©1997, 1998 ARM Limited. All rights reserved. ARM DUI 0040D ARM Software Development Toolkit User Guide Copyright ©1997, 1998 ARM Limited. All rights reserved. Release Information The following changes have been made to this book. Change History Date Issue Change Dec 1996 A Internal release Jan 1997 B First release for SDT 2.10 June 1997 C Updated for SDT 2.11 Nov 1998 D Updated for SDT 2.50 Proprietary Notice ARM, Thumb, StrongARM, and the ARM Powered logo are registered trademarks of ARM Limited. Angel, ARMulator, EmbeddedICE, Multi-ICE, ARM7TDMI, ARM9TDMI, and TDMI are trademarks of ARM Limited. All other products or services mentioned herein may be 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 ©1997, 1998 ARM Limited. All rights reserved. ARM DUI 0040D Contents ARM Software Development Toolkit User Guide Preface About this book ............................................................................................ viii Further reading .............................................................................................. x Typographical conventions ........................................................................... xii Feedback ..................................................................................................... xiii Chapter 1 Introduction 1.1 About the ARM Software Development Toolkit ........................................... 1-2 1.2 Supported platforms .................................................................................... 1-5 1.3 What is new? .............................................................................................. 1-6 Chapter 2 ARM Project Manager 2.1 About the ARM Project Manager ................................................................ 2-2 2.2 Getting started ............................................................................................ 2-4 2.3 The APM desktop ..................................................................................... 2-15 2.4 Additional APM functions .......................................................................... 2-20 2.5 Setting preferences ................................................................................... 2-31 2.6 Working with source files .......................................................................... 2-34 2.7 Viewing object and executable files .......................................................... 2-37 2.8 Working with project templates ................................................................. 2-39 2.9 Build step patterns .................................................................................... 2-47 2.10 Using APM with C++ ................................................................................. 2-52 ARM DUI 0040D Copyright ©1997, 1998 ARM Limited. All rights reserved. iii Contents Chapter 3 ARM Debuggers for Windows and UNIX 3.1 About the ARM Debuggers ......................................................................... 3-2 3.2 Getting started ............................................................................................ 3-7 3.3 ARM Debugger desktop windows ............................................................ 3-14 3.4 Breakpoints, watchpoints, and stepping ................................................... 3-26 3.5 Debugger further details ........................................................................... 3-36 3.6 Channel viewers (Windows only) ............................................................. 3-49 3.7 Configurations .......................................................................................... 3-51 3.8 ARM Debugger with C++ .......................................................................... 3-62 Chapter 4 Command-Line Development 4.1 The hello world example ............................................................................. 4-2 4.2 armsd .......................................................................................................... 4-6 Chapter 5 Basic Assembly Language Programming 5.1 Introduction ................................................................................................. 5-2 5.2 Overview of the ARM architecture .............................................................. 5-3 5.3 Structure of assembly language modules ................................................ 5-10 5.4 Conditional execution ............................................................................... 5-17 5.5 Loading constants into registers ............................................................... 5-22 5.6 Loading addresses into registers .............................................................. 5-27 5.7 Load and store multiple register instructions ............................................ 5-34 5.8 Using macros ............................................................................................ 5-43 5.9 Describing data structures with MAP and # directives ............................. 5-46 Chapter 6 Using the Procedure Call Standards 6.1 About the procedure call standards ............................................................ 6-2 6.2 Using the ARM Procedure Call Standard ................................................... 6-3 6.3 Using the Thumb Procedure Call Standard .............................................. 6-11 6.4 Passing and returning structures .............................................................. 6-13 Chapter 7 Interworking ARM and Thumb 7.1 About interworking ...................................................................................... 7-2 7.2 Basic assembly language interworking ...................................................... 7-4 7.3 C and C++ interworking and veneers ....................................................... 7-12 7.4 Assembly language interworking using veneers ...................................... 7-19 7.5 ARM-Thumb interworking with the ARM Project Manager ....................... 7-23 Chapter 8 Mixed Language Programming 8.1 Using the inline assemblers ........................................................................ 8-2 8.2 Accessing C global variables from assembly code .................................. 8-14 8.3 Using C header files from C++ ................................................................. 8-15 8.4 Calling between C, C++, and ARM assembly language ........................... 8-17 iv Copyright ©1997, 1998 ARM Limited. All rights reserved. ARM DUI 0040D Contents Chapter 9 Handling Processor Exceptions 9.1 Overview ..................................................................................................... 9-2 9.2 Entering and leaving an exception .............................................................. 9-5 9.3 Installing an exception handler ................................................................... 9-9 9.4 SWI handlers ............................................................................................ 9-14 9.5 Interrupt handlers ...................................................................................... 9-22 9.6 Reset handlers .......................................................................................... 9-32 9.7 Undefined instruction handlers ................................................................. 9-33 9.8 Prefetch abort handler .............................................................................. 9-34 9.9 Data abort handler .................................................................................... 9-35 9.10 Chaining exception handlers ..................................................................... 9-37 9.11 Handling exceptions on Thumb-capable processors ................................ 9-39 9.12 System mode ............................................................................................ 9-44 Chapter 10 Writing Code for ROM 10.1 About writing code for ROM ...................................................................... 10-2 10.2 Memory map considerations ..................................................................... 10-3 10.3 Initializing the system ................................................................................ 10-5 10.4 Example 1: Building a ROM to be loaded at address 0 ............................ 10-9 10.5 Example 2: Building a ROM to be entered at its base address ............... 10-17 10.6 Example 3: Using the embedded C library .............................................. 10-19 10.7 Example 4: Simple scatter loading example ........................................... 10-22 10.8 Example 5: Complex scatter load example ............................................. 10-26 10.9 Scatter loading and long-distance branching .......................................... 10-30 10.10 Converting ARM linker ELF output to binary ROM formats .................... 10-32 10.11 Troubleshooting hints and tips ................................................................ 10-34 Chapter 11 Benchmarking, Performance Analysis, and Profiling 11.1 About benchmarking and profiling ............................................................ 11-2 11.2 Measuring code and data size .................................................................. 11-3 11.3 Performance benchmarking ...................................................................... 11-6 11.4 Improving performance and code size .................................................... 11-16 11.5 Profiling ................................................................................................... 11-19 Chapter 12 ARMulator 12.1 About the ARMulator ................................................................................. 12-2 12.2 ARMulator models .................................................................................... 12-3 12.3 Tracer ........................................................................................................ 12-6 12.4 Profiler ..................................................................................................... 12-12 12.5 Windows Hourglass ................................................................................ 12-13 12.6 Watchpoints ............................................................................................ 12-14 12.7 Page table manager ................................................................................ 12-15 12.8 armflat ..................................................................................................... 12-19 12.9 armfast .................................................................................................... 12-20 12.10 armmap ................................................................................................... 12-21 12.11 Dummy MMU .......................................................................................... 12-24 ARM DUI 0040D Copyright ©1997, 1998 ARM Limited. All rights reserved. v Contents 12.12 Angel ...................................................................................................... 12-25 12.13 Controlling the ARMulator using the debugger ....................................... 12-27 12.14 A sample memory model ........................................................................ 12-29 12.15 Rebuilding the ARMulator ....................................................................... 12-32 12.16 Configuring ARMulator to use the example ............................................ 12-34 Chapter 13 Angel 13.1 About Angel .............................................................................................. 13-2 13.2 Developing applications with Angel ........................................................ 13-11 13.3 Angel in operation ................................................................................... 13-29 13.4 Porting Angel to new hardware .............................................................. 13-43 13.5 Configuring Angel ................................................................................... 13-69 13.6 Angel communications architecture ........................................................ 13-73 13.7 Angel C library support SWIs ................................................................. 13-79 13.8 Angel debug agent interaction SWIs ...................................................... 13-95 13.9 The Fusion IP stack for Angel ................................................................ 13-99 Appendix A FlexLM License Manager A.1 About license management ........................................................................ A-2 A.2 Obtaining your license file .......................................................................... A-4 A.3 What to do with your license file ................................................................. A-5 A.4 Starting the server software ........................................................................ A-6 A.5 Running your licensed software ................................................................. A-7 A.6 Customizing your license file ...................................................................... A-9 A.7 Finding a license ....................................................................................... A-11 A.8 Using FlexLM with more than one product ............................................... A-12 A.9 FlexLM license management utilities ........................................................ A-14 A.10 Frequently asked questions about licensing ............................................. A-18 vi Copyright ©1997, 1998 ARM Limited. All rights reserved. ARM DUI 0040D Preface This preface introduces the ARM Software Development Toolkit and its user documentation. It contains the following sections: • About this book on pageviii (cid:129) Further reading on pagex (cid:129) Typographical conventions on pagexii (cid:129) Feedback on pagexiii. ARM DUI 0040D Copyright ©1997, 1998 ARM Limited. All rights reserved. vii Preface About this book This book provides user information for the ARM Software Development Toolkit. It describes the major graphical user interface components of the toolkit, and provides tutorial information on important aspects of developing applications for ARM processors. Organization This book is organized into the following chapters: Chapter1 Introduction Read this chapter for an introduction to the ARM Software Development Toolkit version 2.5, and details of the changes that have been made since version 2.11a. Chapter2 ARM Project Manager Read this chapter for information on the graphical user interface to the ARM tools. APM runs under Windows 95 and NT, and provides a graphical user interface to configure the ARM development tools and manage your software development projects. Chapter3 ARM Debuggers for Windows and UNIX Read this chapter for a description of the ARM graphical user interface debuggers for Windows and UNIX. Chapter4 Command-Line Development Read this chapter for a brief overview of developing programs in a command-line environment. Chapter5 Basic Assembly Language Programming Read this chapter for tutorial information on writing ARM assembly language, including information about effectively using the directives and pseudo-instructions provided by the assembler. Chapter6 Using the Procedure Call Standards Read this chapter for a description of how to use the ARM and Thumb procedure call standards when writing mixed assembly language and C or C++. Chapter7 Interworking ARM and Thumb Read this chapter for information on how to interwork code developed to run in Thumb state and code developed to run in ARM state. viii Copyright ©1997, 1998 ARM Limited. All rights reserved. ARM DUI 0040D Preface Chapter8 Mixed Language Programming Read this chapter for information on developing mixed C, C++, and ARM assembly language programs, and for information on writing inline assembly language code within your C or C++ program. Chapter9 Handling Processor Exceptions Read this chapter for instructions on how to write exception handlers for the ARM processor exceptions. Chapter10 Writing Code for ROM Read this chapter for tutorial information on writing code that is designed to run from ROM. This chapter includes information on using the scatter loading facilities of the ARM linker. Chapter11 Benchmarking, Performance Analysis, and Profiling Read this chapter for a description of how to analyze the performance of your ARM targeted programs. Chapter12 ARMulator Read this chapter for an introduction to the ARM processor emulator. Chapter13 Angel Read this chapter for a description of how to use the Angel debug monitor. This chapter also provides information on porting Angel to your own hardware. AppendixA FlexLM License Manager Read this appendix for instructions on using the FlexLM License Manager. FlexLM is used to manage licenses for the ARM Debugger for UNIX. ARM DUI 0040D Copyright ©1997, 1998 ARM Limited. All rights reserved. ix Preface Further reading This section lists publications from both ARM Limited and third parties that provide additional information on developing for the ARM processor, and general information on related topics such as C and C++ development. ARM publications This book contains reference information that is specific to the ARM Software Development Toolkit. For additional information, refer to the following ARM publications: (cid:129) ARM Software Development Toolkit Reference Guide (ARM DUI 0041) (cid:129) ARM Architectural Reference Manual (ARM DUI 0100) (cid:129) ARM Reference Peripheral Specification (ARM DDI 0062) (cid:129) ARM Target Development System User Guide (ARM DUI 0061) (cid:129) the ARM datasheet for your hardware device. Other publications This book is not intended to be an introduction to the C or C++ programming languages, It does not try to teach programming in C or C++, and it is not a reference manual for the C or C++ standards. The following texts provide general information: ARM architecture (cid:129) Furber, S., ARM System Architecture (1996). Addison Wesley Longman, Harlow, England. ISBN 0-201-40352-8. ISO/IEC C++ reference (cid:129) ISO/IEC JTC1/SC22 Final CD (FCD) Ballot for CD 14882: Information Technology - Programming languages, their environments and system software interfaces - Programming Language C++. This is the December 1996 version of the draft ISO/IEC standard for C++. It is referred to hereafter as the Draft Standard. C++ programming guides The following books provide general C++ programming information: (cid:129) Ellis, M.A. and Stroustrup, B., The Annotated C++ Reference Manual (1990). Addison-Wesley Publishing Company, Reading, Massachusetts. ISBN 0-201-51459-1. x Copyright ©1997, 1998 ARM Limited. All rights reserved. ARM DUI 0040D
Description: