UCS8051-3 IAR Embedded Workbench® C-SPY® Debugging Guide for the 8051 Microcont

UCS8051-3 IAR Embedded Workbench® C-SPY® Debugging Guide for the 8051 Microcontroller Architecture 2 C-SPY® Debugging Guide for 8051 COPYRIGHT NOTICE © 2011–2015 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, C-RUN, C-STAT, visualSTATE, Focus on Your Code, IAR KickStart Kit, IAR Experiment!, I-jet, I-jet Trace, I-scope, IAR Academy, IAR, and the logotype of IAR Systems are trademarks or registered trademarks owned by IAR Systems AB. Microsoft and Windows are registered trademarks of Microsoft Corporation. Intel® is a registered trademark of Intel Corporation. Adobe and Acrobat Reader are registered trademarks of Adobe Systems Incorporated. All other product names are trademarks or registered trademarks of their respective owners. EDITION NOTICE Third edition: May 2015 Part number: UCS8051-3 This guide applies to version 9.2x of IAR Embedded Workbench® for 8051. The C-SPY® Debugging Guide for 8051 replaces all debugging information in the IAR Embedded Workbench IDE User Guide and the hardware debugger guides for 8051. Internal reference: M18, Hom7.2, IJOA. 3 Brief contents Tables ...................................................................................................................... 21 Preface .................................................................................................................... 23 Part 1. Basic debugging ................................................................29 The IAR C-SPY Debugger ........................................................................... 31 Getting started using C-SPY ....................................................................... 43 Executing your application ........................................................................... 59 Variables and expressions ............................................................................ 77 Breakpoints ........................................................................................................ 105 Memory and registers .................................................................................. 131 Part 2. Analyzing your application ................................165 Trace ...................................................................................................................... 167 Profiling ................................................................................................................ 187 Code coverage ................................................................................................. 197 Part 3. Advanced debugging .................................................201 Interrupts ............................................................................................................ 203 C-SPY macros ................................................................................................. 223 The C-SPY command line utility—cspybat ....................................... 277 Part 4. Additional reference information .............325 Debugger options ........................................................................................... 327 Additional information on C-SPY drivers .......................................... 353 4 Target-adapting the ROM-monitor ....................................................... 363 Index ..................................................................................................................... 381 5 Contents Tables ...................................................................................................................... 21 Preface .................................................................................................................... 23 Who should read this guide ...............................................................23 Required knowledge ..........................................................................23 What this guide contains .....................................................................23 Part 1. Basic debugging .....................................................................23 Part 2. Analyzing your application ....................................................24 Part 3. Advanced debugging ..............................................................24 Part 4. Additional reference information ...........................................24 Other documentation ...........................................................................25 User and reference guides ..................................................................25 The online help system ......................................................................26 Web sites ............................................................................................26 Document conventions ........................................................................26 Typographic conventions ...................................................................27 Naming conventions ..........................................................................27 Part 1. Basic debugging ................................................................29 The IAR C-SPY Debugger ........................................................................... 31 Introduction to C-SPY ..........................................................................31 An integrated environment .................................................................31 General C-SPY debugger features .....................................................32 RTOS awareness ................................................................................33 Debugger concepts ................................................................................33 C-SPY and target systems ..................................................................34 The debugger ......................................................................................34 The target system ...............................................................................34 The application ...................................................................................34 C-SPY debugger systems ...................................................................35 The ROM-monitor program ...............................................................35 6 Third-party debuggers ........................................................................35 C-SPY plugin modules .......................................................................35 C-SPY drivers overview .......................................................................36 Differences between the C-SPY drivers ...........................................36 The IAR C-SPY Simulator ..................................................................37 The C-SPY hardware debugger drivers ........................................38 Installing extra software .....................................................................38 Target system with or without a debug probe ....................................39 The C-SPY Infineon driver ................................................................40 ROM-monitor on target hardware ......................................................40 Getting started using C-SPY ....................................................................... 43 Setting up C-SPY ....................................................................................43 Setting up for debugging ....................................................................43 Executing from reset ..........................................................................44 Using a setup macro file .....................................................................44 Selecting a device description file .....................................................44 Loading plugin modules .....................................................................45 Starting C-SPY .........................................................................................45 Starting a debug session .....................................................................45 Loading executable files built outside of the IDE ..............................46 Starting a debug session with source files missing ............................46 Loading multiple images ...................................................................47 Adapting for target hardware ...........................................................48 Modifying a device description file ...................................................48 Initializing target hardware before C-SPY starts ...............................48 Running example projects ..................................................................49 Running an example project ..............................................................49 Reference information on starting C-SPY ...................................50 C-SPY Debugger main window .........................................................50 Images window ..................................................................................55 Get Alternative File dialog box ..........................................................56 Contents 7 Executing your application ........................................................................... 59 Introduction to application execution ...........................................59 Briefly about application execution ...................................................59 Source and disassembly mode debugging .........................................59 Single stepping ...................................................................................60 Stepping speed ...................................................................................62 Running the application .....................................................................63 Highlighting .......................................................................................64 Call stack information ........................................................................64 Terminal input and output ..................................................................65 Debug logging ....................................................................................65 Reference information on application execution .....................66 Disassembly window .........................................................................66 Call Stack window .............................................................................70 Terminal I/O window .........................................................................72 Terminal I/O Log File dialog box ......................................................73 Debug Log window ............................................................................74 Log File dialog box ............................................................................75 Report Assert dialog box ....................................................................76 Autostep settings dialog box ..............................................................76 Variables and expressions ............................................................................ 77 Introduction to working with variables and expressions ......77 Briefly about working with variables and expressions ......................77 C-SPY expressions .............................................................................78 Limitations on variable information ..................................................80 Working with variables and expressions ......................................81 Using the windows related to variables and expressions ...................81 Viewing assembler variables .............................................................81 Getting started using data logging .....................................................82 Reference information on working with variables and expressions ................................................................................................83 Auto window ......................................................................................84 Locals window ...................................................................................86 8 Watch window ...................................................................................88 Live Watch window ...........................................................................90 Statics window ...................................................................................92 Quick Watch window .........................................................................95 Symbols window ................................................................................97 Resolve Symbol Ambiguity dialog box .............................................99 Data Log window .............................................................................100 Data Log Summary window ............................................................102 Breakpoints ........................................................................................................ 105 Introduction to setting and using breakpoints ........................105 Reasons for using breakpoints .........................................................105 Briefly about setting breakpoints .....................................................105 Breakpoint types ..............................................................................106 Breakpoint icons ..............................................................................108 Breakpoints in the C-SPY simulator ................................................108 Breakpoints in the C-SPY hardware debugger drivers ....................108 Breakpoint consumers ......................................................................110 Setting breakpoints ..............................................................................111 Various ways to set a breakpoint .....................................................111 Toggling a simple code breakpoint ..................................................112 Setting breakpoints using the dialog box .........................................112 Setting a data breakpoint in the Memory window ...........................113 Setting breakpoints using system macros ........................................114 Useful breakpoint hints ....................................................................114 Reference information on breakpoints .......................................116 Breakpoints window ........................................................................117 Breakpoint Usage window ...............................................................118 Code breakpoints dialog box ............................................................119 Log breakpoints dialog box ..............................................................121 Range breakpoints dialog box ..........................................................123 Data breakpoints dialog box ............................................................124 Data Log breakpoints dialog box .....................................................126 Immediate breakpoints dialog box ...................................................127 Contents 9 Enter Location dialog box ................................................................128 Resolve Source Ambiguity dialog box ............................................130 Memory and registers .................................................................................. 131 Introduction to monitoring memory and registers ...............131 Briefly about monitoring memory and registers ..............................131 C-SPY memory zones ......................................................................132 Stack display ....................................................................................133 Memory access checking .................................................................134 Monitoring memory and registers ................................................134 Configuring C-SPY to match the memory of your device ...............135 Defining application-specific register groups ..................................135 Reference information on memory and registers ..................136 Memory window ..............................................................................137 Memory Save dialog box .................................................................141 Memory Restore dialog box .............................................................142 Fill dialog box ..................................................................................143 Symbolic Memory window ..............................................................144 Stack window ...................................................................................147 Register window ..............................................................................150 SFR Setup window ...........................................................................152 Edit SFR dialog box .........................................................................155 Memory Configuration dialog box, in C-SPY hardware debugger drivers ..............................................157 Edit Memory Range dialog box, for C-SPY hardware debugger drivers .............................................160 Memory Access Setup dialog box ...................................................162 Edit Memory Access dialog box ......................................................164 Part 2. Analyzing your application ................................165 Trace ...................................................................................................................... 167 Introduction to using trace ..............................................................167 Reasons for using trace ....................................................................167 10 Briefly about trace ............................................................................167 Requirements for using trace ...........................................................168 Collecting and using trace data ......................................................168 Getting started with trace .................................................................168 Trace data collection using breakpoints ...........................................168 Searching in trace data .....................................................................169 Browsing through trace data ............................................................169 Reference information on trace .....................................................170 Trace window ...................................................................................170 Function Trace window ...................................................................172 Timeline window ............................................................................173 Viewing Range dialog box ...............................................................180 Trace Start breakpoints dialog box ..................................................181 Trace Stop breakpoints dialog box ...................................................182 Trace Expressions window ..............................................................183 Find in Trace dialog box ..................................................................184 Find in Trace window ......................................................................185 Profiling ................................................................................................................ 187 Introduction to the profiler ..............................................................187 Reasons for using the profiler ..........................................................187 Briefly about the profiler ..................................................................187 Requirements for using the profiler .................................................188 Using the profiler ..................................................................................188 Getting started using the profiler on function level .........................188 Analyzing the profiling data ............................................................189 Getting started using the profiler on instruction level ......................191 Reference information on the profiler ........................................192 Function Profiler window ................................................................192 Code coverage ................................................................................................. 197 Introduction to code coverage .......................................................197 Reasons for using code coverage .....................................................197 Briefly about code coverage ............................................................197 Requirements and restrictions for using code coverage ...................197 Contents 11 Reference information on code coverage ..................................197 Code Coverage window ...................................................................198 Part 3. Advanced debugging .................................................201 Interrupts ............................................................................................................ 203 Introduction to interrupts ................................................................203 Briefly about interrupt logging ........................................................203 Briefly about the interrupt simulation system ..................................204 Interrupt characteristics ....................................................................205 Interrupt simulation states ................................................................205 C-SPY system macros for interrupt simulation ...............................206 Target-adapting the interrupt simulation system .............................207 Using the interrupt system ..............................................................207 Simulating a simple interrupt ...........................................................208 Simulating an interrupt in a multi-task system ................................210 Getting started using interrupt logging ............................................210 Reference information on interrupts ...........................................211 Interrupt Setup dialog box ................................................................211 Edit Interrupt dialog box ..................................................................213 Forced Interrupt window ..................................................................214 Interrupt Status window ...................................................................215 Interrupt Log window ......................................................................217 Interrupt Log Summary window ......................................................220 C-SPY macros ................................................................................................. 223 Introduction to C-SPY macros .......................................................223 Reasons for using C-SPY macros ....................................................223 Briefly about using C-SPY macros ..................................................224 Briefly about setup macro functions and files .................................224 Briefly about the macro language ....................................................224 Using C-SPY macros ...........................................................................225 Registering C-SPY macros—an overview .......................................226 Executing C-SPY macros—an overview .........................................226 12 Registering and executing using setup macros uploads/s1/ ew8051-debuggingguide.pdf

  • 23
  • 0
  • 0
Afficher les détails des licences
Licence et utilisation
Gratuit pour un usage personnel Attribution requise
Partager
  • Détails
  • Publié le Aoû 17, 2022
  • Catégorie Administration
  • Langue French
  • Taille du fichier 5.0145MB