IAR Embedded Workbench® IDE User Guide for Advanced RISC Machines Ltd’s ® ARM Cores UARM-16 COPYRIGHT NOTICE Copyright © 1999–2009 IAR Systems AB. No part of this document may be reproduced without the prior written consent of IAR Systems AB. The software described in this document is furnished under a license and may only be used or copied in accordance with the terms of such a license. DISCLAIMER The information in this document is subject to change without notice and does not represent a commitment on any part of IAR Systems. While the information contained herein is assumed to be accurate, IAR Systems assumes no responsibility for any errors or omissions. In no event shall IAR Systems, its employees, its contractors, or the authors of this document be liable for special, direct, indirect, or consequential damage, losses, costs, charges, claims, demands, claim for lost profits, fees, or expenses of any nature or kind. TRADEMARKS IAR Systems, IAR Embedded Workbench, C-SPY, visualSTATE, From Idea To Target, IAR KickStart Kit, IAR PowerPac, IAR YellowSuite, IAR Advanced Development Kit, IAR, and the IAR Systems logotype are trademarks or registered trademarks owned by IAR Systems AB. J-Link is a trademark licensed to IAR Systems AB. Microsoft and Windows are registered trademarks of Microsoft Corporation. ARM and Thumb are registered trademarks of Advanced RISC Machines Ltd. EmbeddedICE is a trademark of Advanced RISC Machines Ltd. OCDemon is a trademark of Macraigor Systems LLC. μC/OS-II is a trademark of Micriμm, Inc. CMX-RTX is a trademark of CMX Systems, Inc. ThreadX is a trademark of Express Logic. RTXC is a trademark of Quadros Systems. Fusion is a trademark of Unicoi Systems. Adobe and Acrobat Reader are registered trademarks of Adobe Systems Incorporated. CodeWright is a registered trademark of Starbase Corporation. All other product names are trademarks or registered trademarks of their respective owners. EDITION NOTICE Sixteenth edition: July 2009 Part number: UARM-16 This guide describes version 5.3x of the IAR Embedded Workbench® IDE for Advanced RISC Machines Ltd’s ARM cores family. Internal reference: 5.5.x. tut2009.1, IMAE. UARM-16 Brief contents Tables .................................................................................................................. xxvii Figures ............................................................................................................... xxxiii Preface .................................................................................................................. xliii Part 1. Product overview .............................................................1 Product introduction ........................................................................................ 3 Installed files ........................................................................................................ 19 Part 2. Tutorials ....................................................................................27 Welcome to the tutorials ............................................................................. 29 Creating an application project ................................................................. 33 Debugging using the IAR C-SPY® Debugger ..................................... 45 Mixing C and assembler modules ............................................................ 55 Using C++ ............................................................................................................ 59 Simulating an interrupt .................................................................................. 63 Creating and using libraries ......................................................................... 73 Part 3. Project management and building ............77 The development environment ................................................................. 79 Managing projects ............................................................................................. 85 Building ................................................................................................................... 95 Editing ................................................................................................................... 103 iii UARM-16 Part 4. Debugging ..............................................................................113 The IAR C-SPY® Debugger ..................................................................... 115 Executing your application ......................................................................... 125 Working with variables and expressions ............................................ 133 Using breakpoints ........................................................................................... 141 Monitoring memory and registers ........................................................ 149 Using the C-SPY® macro system .......................................................... 155 Analyzing your application ......................................................................... 163 Part 5. The C-SPY® Simulator .........................................169 Simulator-specific debugging ..................................................................... 171 Simulating interrupts ..................................................................................... 193 Part 6. C-SPY hardware debugger systems ......205 Introduction to C-SPY® hardware debugger systems ............... 207 Hardware-specific debugging .................................................................... 223 Analyzing your program using driver-specific tools ...................... 249 Using flash loaders ......................................................................................... 297 Part 7. Reference information ...........................................303 IAR Embedded Workbench® IDE reference ................................... 305 C-SPY® reference .......................................................................................... 389 General options .............................................................................................. 431 Compiler options ........................................................................................... 439 Assembler options ......................................................................................... 453 IAR Embedded Workbench® IDE iv User Guide for ARM UARM-16 Brief contents Converter options ......................................................................................... 461 Custom build options ................................................................................... 463 Build actions options .................................................................................... 465 Linker options .................................................................................................. 467 Library builder options ................................................................................ 477 Debugger options ........................................................................................... 479 The C-SPY Command Line Utility—cspybat ................................... 485 C-SPY® macros reference ........................................................................ 513 Index ..................................................................................................................... 555 v UARM-16 IAR Embedded Workbench® IDE vi User Guide for ARM UARM-16 Contents Tables .................................................................................................................. xxvii Figures ............................................................................................................... xxxiii Preface .................................................................................................................. xliii Who should read this guide .............................................................xliii How to use this guide .........................................................................xliii What this guide contains ...................................................................xliv Other documentation ........................................................................xlvii Document conventions ....................................................................xlviii Typographic conventions ...............................................................xlviii Naming conventions ........................................................................xlix Part 1. Product overview .............................................................1 Product introduction ........................................................................................ 3 The IAR Embedded Workbench IDE ..............................................3 An extensible and modular environment .............................................3 Features ................................................................................................4 Documentation .....................................................................................5 IAR C-SPY Debugger ..............................................................................5 The C-SPY driver .................................................................................6 General C-SPY debugger features .......................................................6 C-SPY plugin modules .........................................................................8 RTOS awareness ..................................................................................9 Documentation .....................................................................................9 IAR C-SPY Debugger systems ............................................................9 IAR C-SPY Simulator ........................................................................10 IAR C-SPY J-Link driver .................................................................10 IAR C-SPY LMI FTDI driver ...........................................................11 IAR C-SPY RDI driver ......................................................................11 IAR C-SPY Macraigor driver ...........................................................12 vii UARM-16 IAR C-SPY ROM-monitor driver .....................................................13 IAR C-SPY ANGEL debug monitor driver .......................................14 IAR C-SPY ST-Link driver ..............................................................14 IAR C/C++ Compiler .............................................................................15 Features ..............................................................................................15 Runtime environment .........................................................................16 Documentation ...................................................................................16 IAR Assembler .........................................................................................16 Features ..............................................................................................17 Documentation ...................................................................................17 IAR ILINK Linker and accompanying tools .................................17 Features ..............................................................................................18 Documentation ...................................................................................18 Installed files ........................................................................................................ 19 Directory structure ................................................................................19 Root directory ....................................................................................19 The ARM directory ............................................................................19 The common directory .......................................................................21 The install-info directory ...................................................................21 File types .....................................................................................................21 Files with non-default filename extensions .......................................23 Documentation ........................................................................................23 The user and reference guides ............................................................24 Online help .........................................................................................25 IAR Systems on the web ....................................................................25 Part 2. Tutorials ....................................................................................27 Welcome to the tutorials ............................................................................. 29 Tutorials overview .................................................................................29 Creating an application project ..........................................................29 Debugging using the IAR C-SPY® Debugger ..................................29 Mixing C and assembler modules ......................................................30 IAR Embedded Workbench® IDE viii User Guide for ARM UARM-16 Contents Using C++ ..........................................................................................30 Simulating an interrupt .......................................................................30 Creating and using libraries ...............................................................30 Getting started ....................................................................................31 Creating an application project ................................................................. 33 Setting up a new project .....................................................................33 Creating a Workspace ........................................................................33 Creating the new project ....................................................................34 Adding files to the project ..................................................................36 Setting project options .......................................................................37 Compiling and linking the application ...........................................39 Compiling the source files .................................................................40 Viewing the list file ............................................................................41 Linking the application ......................................................................43 Viewing the map file ..........................................................................44 Debugging using the IAR C-SPY® Debugger ..................................... 45 Debugging the application ..................................................................45 Starting the debugger .........................................................................45 Organizing the windows ....................................................................45 Inspecting source statements ..............................................................46 Inspecting variables ...........................................................................48 Setting and monitoring breakpoints ...................................................50 Debugging in disassembly mode ......................................................51 Monitoring memory ...........................................................................51 Viewing terminal I/O .........................................................................53 Reaching program exit .......................................................................53 Mixing C and assembler modules ............................................................ 55 Examining the calling convention ....................................................55 Adding an assembler module to the project ..............................57 Setting up the project .........................................................................57 ix UARM-16 Using C++ ............................................................................................................ 59 Creating a C++ application .................................................................59 Compiling and linking the C++ application .......................................59 Setting a breakpoint and executing to it .............................................60 Printing the Fibonacci numbers .........................................................62 Simulating an interrupt .................................................................................. 63 Adding an interrupt handler ..............................................................63 The application—a brief description ..................................................63 Writing an interrupt handler ...............................................................64 Setting up the project .........................................................................64 Setting up the simulation environment ........................................64 Defining a C-SPY setup macro file ....................................................65 Setting C-SPY options .......................................................................66 Building the project ............................................................................67 Starting the simulator .........................................................................67 Specifying a simulated interrupt .......................................................68 Setting an immediate breakpoint ........................................................69 Simulating the interrupt ......................................................................70 Executing the application ...................................................................70 Using macros for interrupts and breakpoints ............................72 Creating and using libraries ......................................................................... 73 Using libraries ..........................................................................................73 Creating a new project .......................................................................74 Creating a library project ...................................................................74 Using the library in your application project .....................................75 Part 3. Project management and building ............77 The development environment ................................................................. 79 The IAR Embedded Workbench IDE ............................................79 The tool chain .....................................................................................79 Running the IDE ...............................................................................80 IAR Embedded Workbench® IDE x User Guide for ARM UARM-16
Description: