Upload
others
View
24
Download
0
Embed Size (px)
Citation preview
CSSTM8HW-2:Final
IAR C-SPY® Hardware Debugger SystemsUser Guide
for STMicroelectronics’STM8 Microprocessor Family
CSSTM8HW-2
CSSTM8HW-2:Final
COPYRIGHT NOTICECopyright © 2010 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.
DISCLAIMERThe 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.
TRADEMARKSIAR 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.
STMicroelectronics is a registered trademark of STMicroelectronics Corporation. STM8 is a trademark of STMicroelectronics Corporation.
All other product names are trademarks or registered trademarks of their respective owners.
EDITION NOTICE
Second edition: June 2010
Part number: CSSTM8HW-2
This guide applies to version 1.x of IAR Embedded Workbench® for STM8.
Internal reference: M3, Too6.0, IMAE.
UTooticki6.0.0-1:1
iii
ContentsPreface ...................................................................................................................... v
Who should read this guide ................................................................. v
How to use this guide ............................................................................. v
What this guide contains ......................................................................vi
Other documentation ............................................................................vi
Document conventions .........................................................................vi
Typographic conventions ...................................................................vii
Naming conventions ..........................................................................vii
Introduction to C-SPY® hardware debugger systems ................... 1
The C-SPY hardware debugger systems ........................................ 1
Differences between the C-SPY drivers ............................................. 1
The C-SPY STice driver ........................................................................ 2
Hardware installation ........................................................................... 3
The C-SPY ST-LINK driver .................................................................. 4
Hardware installation ........................................................................... 4
Getting started .......................................................................................... 5
Running the demo program .................................................................. 5
Hardware-specific debugging ...................................................................... 7
Debugger options for debugging using hardware systems ..... 7
STice-specific debugging ....................................................................... 8
Setup ..................................................................................................... 8
The STice menu ................................................................................... 9
ST-LINK-specific debugging ............................................................... 10
Setup ................................................................................................... 10
The ST-LINK menu ........................................................................... 11
Using the profiler .................................................................................... 11
Reasons for using the profiler ............................................................ 12
Requirements for using the profiler ................................................... 12
Getting started using the profiler on function level ........................... 13
Getting started using the profiler on instruction level ........................ 13
UTooticki6.0.0-1:1
ivIAR Embedded Workbench® IDEUser Guide for XXXXX
Related reference information ............................................................ 14
Function Profiler window .................................................................. 15
Using breakpoints ................................................................................... 17
Available breakpoints ........................................................................ 17
Breakpoint Usage dialog box ............................................................. 18
Advanced breakpoint dialog box ....................................................... 18
Resolving problems ................................................................................ 22
Write failure during load .................................................................... 22
No contact with the target hardware .................................................. 23
Index ....................................................................................................................... 25
CSSTM8HW-2:Final
v
PrefaceWelcome to the IAR C-SPY® Hardware Debugger Systems User Guide. The purpose of this guide is to provide you with detailed reference information that can help you use the features in the IAR C-SPY® Hardware Debugger Systems for STM8.
Who should read this guideYou should read this guide if you want to get the most out of the features in the C-SPY hardware debugger systems. In addition, you should have working knowledge of:
● The C or C++ programming language
● Application development for embedded systems
● The architecture and instruction set of the STM8 microcontroller (refer to the chip manufacturer's documentation)
● The operating system of your host machine.
This guide also assumes that you already have working knowledge of the target system you are using, as well as some working knowledge of the IAR C-SPY Debugger. For a quick introduction to the IAR C-SPY Debugger, see the tutorials available in the IAR Embedded Workbench® IDE User Guide.
How to use this guideThis guide describes the C-SPY interface to the target system you are using; this guide does not describe the general features available in the IAR C-SPY debugger or the hardware target system. To take full advantage of the whole debugger system, you must read this guide in combination with:
● The IAR Embedded Workbench® IDE User Guide which describes the general features available in the C-SPY debugger
● The documentation supplied with the target system you are using.
Note that additional features might have been added to the software after the IAR C-SPY® Hardware Debugger Systems User Guide was printed. The IAR Information Center contains the latest information.
CSSTM8HW-2:Final
vi
What this guide contains
IAR C-SPY® Hardware Debugger SystemsUser Guide
What this guide containsBelow is a brief outline and summary of the chapters in this guide.
● Introduction to C-SPY® hardware debugger systems introduces you to the available C-SPY drivers to be used for the target systems STice and ST-LINK. The chapter briefly shows the difference in functionality provided by the different C-SPY drivers.
● Hardware-specific debugging describes the additional options, menus, and features provided by these debugger systems.
Other documentationThe complete set of IAR development tools for the STM8 microcontroller are described in a series of guides. These guides can be found in the stm8\doc directory or reached from the Help menu.
All of these guides are delivered in hypertext PDF or HTML format on the installation media.
Recommended web sites:
● The STMicroelectronics web site, www.st.com, contains information and news about the STM8 microcontrollers.
● The IAR Systems web site, www.iar.com, holds application notes and other product information.
Document conventions When, in this text, we refer to the programming language C, the text also applies to C++, unless otherwise stated.
When referring to a directory in your product installation, for example stm8\doc, the full path to the location is assumed, for example c:\Program Files\IAR Systems\Embedded Workbench 6.n\stm8\doc.
CSSTM8HW-2:Final
Preface
vii
TYPOGRAPHIC CONVENTIONS
This guide uses the following typographic conventions:
NAMING CONVENTIONS
The following naming conventions are used for the products and tools from IAR Systems® referred to in this guide:
Style Used for
computer • Source code examples and file paths.• Text on the command line.• Binary, hexadecimal, and octal numbers.
parameter A placeholder for an actual value used as a parameter, for example filename.h where filename represents the name of the file.
[option] An optional part of a command.
a|b|c Alternatives in a command.
{a|b|c} A mandatory part of a command with alternatives.
bold Names of menus, menu commands, buttons, and dialog boxes that appear on the screen.
italic • A cross-reference within this guide or to another guide.• Emphasis.
… An ellipsis indicates that the previous item can be repeated an arbitrary number of times.
Identifies instructions specific to the IAR Embedded Workbench® IDE interface.
Identifies instructions specific to the command line interface.
Identifies helpful tips and programming hints.
Identifies warnings.
Table 1: Typographic conventions used in this guide
Brand name Generic term
IAR Embedded Workbench® for STM8 IAR Embedded Workbench®
IAR Embedded Workbench® IDE for STM8 the IDE
IAR C-SPY® Debugger for STM8 C-SPY, the debugger
IAR C-SPY® Simulator the simulator
IAR C/C++ Compiler™ for STM8 the compiler
Table 2: Naming conventions used in this guide
CSSTM8HW-2:Final
viii
Document conventions
IAR C-SPY® Hardware Debugger SystemsUser Guide
IAR Assembler™ for STM8 the assembler
IAR XLINK™ Linker XLINK, the linker
IAR DLIB Library™ the DLIB library
Brand name Generic term
Table 2: Naming conventions used in this guide (Continued)
CSSTM8HW-2:Final
1
Introduction to C-SPY® hardware debugger systemsThis chapter introduces you to the C-SPY hardware debugger systems and to how they differ from the C-SPY Simulator.
The C-SPY hardware debugger systemsC-SPY consists of both a general part which provides a basic set of C-SPY features, and a driver. The C-SPY driver is the part that provides communication with and control of the target system. The driver also provides a user interface—special menus, windows, and dialog boxes—to the functions provided by the target system, for instance special breakpoints. This driver is automatically installed during the installation of IAR Embedded Workbench.
The IAR C-SPY Debugger for the STM8 microcontrollers is available with drivers for these target systems:
● Simulator
● STice
● ST-LINK.
For further details about the concepts that are related to C-SPY and general debugger features, see the IAR Embedded Workbench® IDE User Guide.
DIFFERENCES BETWEEN THE C-SPY DRIVERS
This table summarizes the key differences between the C-SPY drivers:
Feature Simulator STice ST-LINK
Code breakpoints x x1 x1
Data breakpoints x -- x1
Execution in real time -- x x
Zero memory footprint x x x
Simulated interrupts x -- --
Real interrupts -- x x
Table 3: Driver differences
CSSTM8HW-2:Final
2
The C-SPY STice driver
IAR C-SPY® Hardware Debugger SystemsUser Guide for STM8
1 For detailed information about available breakpoints, see Available breakpoints, page 17.2 For more information, see the IAR Embedded Workbench® IDE User Guide.3 For more information about trace, see the online help system.
General descriptions of the different drivers follow.
The C-SPY STice driverThe C-SPY STice driver is automatically installed during the installation of IAR Embedded Workbench. Using the C-SPY STice driver, C-SPY can connect to the STice emulator.
Interrupt logging x -- --
Live watch -- x x
Cycle counter x -- --
Code coverage2 x x --
Data coverage2 x x --
Function/instruction profiler x x --
Trace3 x x --
Feature Simulator STice ST-LINK
Table 3: Driver differences (Continued)
CSSTM8HW-2:Final
Introduction to C-SPY® hardware debugger systems
3
The C-SPY STice driver uses the USB port to communicate with the STice emulator. The STice emulator communicates with the STice or SWIM interface on the microcontroller.
Figure 1: C-SPY STice communication overview
Note: If you are using the SWIM interface, not all emulator features are available.
For further information, refer to the documentation supplied with the STice emulator.
When a debugging session is started, your application is automatically downloaded and programmed into flash memory. You can disable this feature, if necessary.
HARDWARE INSTALLATION
For information about the hardware installation, see the documentation supplied with the STice emulator from STMicroelectronics. The following power-up sequence is recommended to ensure proper communication between the target board, STice, and C-SPY:
1 Connect the STice emulator to your host computer.
2 Power up the target board.
3 Power up STice.
4 Start the C-SPY debugging session.
Host computer
C-SPYDebugger
C-SPY STice driver
STice
STice cable or SWIM cable
Target board
FLASH RAM
CPUOCD logic
USB connection
emulator
CSSTM8HW-2:Final
4
The C-SPY ST-LINK driver
IAR C-SPY® Hardware Debugger SystemsUser Guide for STM8
The C-SPY ST-LINK driverThe C-SPY ST-LINK driver is automatically installed during the installation of IAR Embedded Workbench. Using the C-SPY ST-LINK driver, C-SPY can connect to the ST-LINK debug probe.
The C-SPY ST-LINK driver uses the USB port to communicate with the ST-LINK. The ST-LINK communicates with the SWIM interface on the microcontroller.
Figure 2: C-SPY ST-LINK communication overview
For further information, refer to the documentation supplied with the ST-LINK debug probe.
When a debugging session is started, your application is automatically downloaded and programmed into flash memory. You can disable this feature, if necessary.
HARDWARE INSTALLATION
For information about the hardware installation, see the documentation supplied with the ST-LINK from STMicroelectronics. The following power-up sequence is recommended to ensure proper communication between the target board, ST-LINK, and C-SPY:
1 Connect the ST-LINK debug probe to your host computer.
Host computer
C-SPYDebugger
C-SPY ST-LINK driver
ST-LINK
SWIM cable
Target board
FLASH RAM
CPUOCD logic
USB connection
CSSTM8HW-2:Final
Introduction to C-SPY® hardware debugger systems
5
2 Power up the target board.
3 Start the C-SPY debugging session.
Getting startedIAR Embedded Workbench comes with example applications. You can use these examples to get started using the development tools from IAR Systems or simply to verify that contact has been established with your target board. You can also use the examples as a starting point for your application project.
You can find the examples in the stm8\examples directory. The examples are ready to be used as is. They are supplied with ready-made workspace files, together with source code files and all the other related files.
RUNNING THE DEMO PROGRAM
1 To use an example application, choose Help>Information Center and click EXAMPLE PROJECTS.
2 Browse to the example that matches the specific evaluation board or starter kit you are using.
Figure 3: Example application
Click Open Project.
CSSTM8HW-2:Final
6
Getting started
IAR C-SPY® Hardware Debugger SystemsUser Guide for STM8
3 In the dialog box that appears, choose a destination folder for your project location. Click Select to confirm your choice.
4 The available example projects are displayed in the workspace window. Select one of the projects, and if it is not the active project (highlighted in bold), right-click it and choose Set As Active from the context menu.
5 To view the project settings, select the project and choose Options from the context menu. Verify the settings of the options Device and Debugger>Driver. As for other settings, the project is set up to suit the target system you selected.
For further details about the C-SPY options for the hardware target system and how to configure C-SPY to interact with the target board, see Debugger options for debugging using hardware systems, page 7.
Click OK to close the Options dialog box.
6 To compile and link the application, choose Project>Make or click the Make button.
7 To start C-SPY, choose Project>Debug or click the Debug button. If C-SPY fails to establish contact with the target system, see Resolving problems, page 22.
8 Choose Execute>Go or click the Go button to start the application.
Click the Stop button to stop execution.
CSSTM8HW-2:Final
7
Hardware-specific debuggingThis chapter describes the additional options, menus, and features provided by the C-SPY® hardware debugger systems. The chapter contains the following sections:
● Debugger options for debugging using hardware systems
● STice-specific debugging
● ST-LINK-specific debugging
● Using the profiler
● Using breakpoints
● Resolving problems.
See also the section Using trace in the online help system.
Debugger options for debugging using hardware systemsBefore you start any C-SPY hardware debugger you must set some options for the debugger system—both C-SPY generic options and options required for the hardware system (C-SPY driver-specific options). Follow this procedure:
1 To open the Options dialog box, choose Project>Options.
2 To set C-SPY generic options and select a C-SPY driver:
● Select Debugger from the Category list
● On the Setup page, select the appropriate C-SPY driver from the Driver drop-down list.
For information about the settings Setup macros, Run to, and Device descriptions, as well as for information about the pages Extra Options and Plugins, see the IAR Embedded Workbench® IDE User Guide.
Note that a default device description file and linker configuration file is automatically selected depending on your selection of a device on the General Options>Target page.
CSSTM8HW-2:Final
8
STice-specific debugging
IAR C-SPY® Hardware Debugger SystemsUser Guide for STM8
3 To set the driver-specific options, select the appropriate driver from the Category list. Depending on which C-SPY driver you are using, different sets of option pages appears.
For details about each page, see:
● Setup, page 8, for the STice options
● Setup, page 10, for the ST-LINK options.
4 When you have set all the required options, click OK in the Options dialog box.
STice-specific debuggingIn this section you can read about the features specific for the C-SPY STice driver:
● Setup, page 8
● The STice menu, page 9.
SETUP
On the Setup page you can set part of the options specific to the C-SPY STice driver.
Figure 4: STice options
Download
By default, C-SPY downloads the application to RAM or flash when a debug session starts. The Download options lets you modify the behavior of the download.
CSSTM8HW-2:Final
Hardware-specific debugging
9
Suppress
Use this option to debug an application that already resides in target memory. When this option is selected, the code download is disabled, while preserving the present content of the flash.
If this option is combined with the Verify option, the debugger will read back the code image from non-volatile memory and verify that it is identical to the debugged program.
Verify
Use this option to verify that the downloaded code image can be read back from target memory with the correct contents.
Communication options
Use the option Use SWIM interface to enable the SWIM interface. Using the SWIM interface makes the STice emulator behave as ST-LINK. See ST-LINK-specific debugging, page 10 for more information.
Communication log
Use the option Use communication log file to log the communication between C-SPY and the target system to the specified log file, which can be useful for troubleshooting purposes. The communication will be logged in the file cspycomm.log located in the current working directory. If required, use the browse button to locate a different file.
THE STICE MENU
When you are using the C-SPY STice driver, the STice menu appears in C-SPY.
Figure 5: The STice menu
These commands are available on the STice menu:
Menu command Description
Trace Settings Displays the Trace Settings dialog box where you can configure the the trace data generation and collection. For reference information, see the online help system.
Table 4: Commands on the STice menu
CSSTM8HW-2:Final
10
ST-LINK-specific debugging
IAR C-SPY® Hardware Debugger SystemsUser Guide for STM8
ST-LINK-specific debuggingIn this section you can read about the features specific for the C-SPY ST-LINK driver:
● Setup, page 10
● The ST-LINK menu, page 11.
SETUP
The ST-LINK page contains all the options specific to the ST-LINK driver.
Figure 6: ST-LINK options
Download
By default, C-SPY downloads the application to RAM or flash when a debug session starts. The Download options lets you modify the behavior of the download.
Trace Displays the Trace window. For reference information, see the online help system.
Function Trace Opens the Function Trace window to display a subset of the trace data displayed in the Trace window. For reference information, see the online help system.
Function Profiler Displays the Function Profiler window, see Function Profiler window, page 15.
Breakpoint Usage Displays the Breakpoint Usage dialog box which lists all active breakpoints; see Breakpoint Usage dialog box, page 18.
Menu command Description
Table 4: Commands on the STice menu (Continued)
CSSTM8HW-2:Final
Hardware-specific debugging
11
Suppress
Use this option to debug an application that already resides in target memory. When this option is selected, the code download is disabled, while preserving the present content of the flash.
If this option is combined with the Verify option, the debugger will read back the code image from non-volatile memory and verify that it is identical to the debugged program.
Verify
Use this option to verify that the downloaded code image can be read back from target memory with the correct contents.
Communication log
Use the option Use communication log file to log the communication between C-SPY and the target system to the specified log file, which can be useful for troubleshooting purposes. The communication will be logged in the file cspycomm.log located in the current working directory. If required, use the browse button to locate a different file.
THE ST-LINK MENU
When you are using the C-SPY ST-LINK driver, the ST-LINK menu appears in C-SPY.
Figure 7: The ST-LINK menu
This command is available on the ST-LINK menu:
Using the profilerThis section gives you information about using the profiler. More specifically, these topics are covered:
● Reasons for using the profiler, page 12
● Requirements for using the profiler, page 12
● Getting started using the profiler on function level, page 13
● Getting started using the profiler on instruction level, page 13
Menu command Description
Breakpoint Usage Displays the Breakpoint Usage dialog box which lists all active breakpoints; see Breakpoint Usage dialog box, page 18.
Table 5: Commands on the ST-LINK menu
CSSTM8HW-2:Final
12
Using the profiler
IAR C-SPY® Hardware Debugger SystemsUser Guide for STM8
● Related reference information, page 14.
Note: This profiler is part of the C-SPY driver and should not be confused with the profiling system provided as a plug-in module, see Function-level profiling, page 147.
REASONS FOR USING THE PROFILER
● Function profiling information is displayed in the Function Profiler window, that is, timing information for the functions in an application. The profiler measures the time between the entry and return of a function. This means that time consumed in a function is not added until the function returns or another function is called. You will only notice this if you are stepping into a function. Profiling must be turned on explicitly using a button on the window’s toolbar, and will stay enabled until it is turned off.
● Instruction profiling information is displayed in the Disassembly window, that is, the number of times each instruction has been executed.
Function profiling can help you find the functions where the most time is spent during execution. Focus on those functions when optimizing your code. A simple method of optimizing a function is to compile it using speed optimization. Alternatively, you can move the function into the memory which uses the most efficient addressing mode. For detailed information about efficient memory usage, see the IAR C/C++ Development Guide for STM8.
Instruction profiling can help you fine-tune your code on a very detailed level, especially for assembler source code. Instruction profiling can also help you to understand where your compiled C/C++ source code spends most of its time, and perhaps give insight into how to rewrite it for better performance.
REQUIREMENTS FOR USING THE PROFILER
To use the profiler, you need:
● A device that is supported by STice
● To enable the options Instruction, Discarded, and Interrupted in the Trace Settings dialog box. For more information about the Trace Settings dialog box, see the online help system.
STice uses trace for function profiling and built-in STice features for instruction profiling.
Note:
● Instruction profiling cannot be used at the same time as trace or data coverage.
● Function profiling cannot be used at the same time as code coverage, data coverage, or instruction profiling.
CSSTM8HW-2:Final
Hardware-specific debugging
13
GETTING STARTED USING THE PROFILER ON FUNCTION LEVEL
To display function profiling information in the Function Profiler window, follow these steps:
1 Make sure you build your application using these options:
2 Enable trace to set up the profiler for function profiling.
3 When you have built your application and started C-SPY, choose STice>Function Profiler to open the Function Profiler window, and click the Enable button to turn on the profiler. Alternatively, choose Enable from the context menu that is available when you right-click in the Function Profiler window.
4 Start executing your application to collect the profiling information.
5 Profiling information is displayed in the Function Profiler window. To sort, click on the relevant column header.
6 When you start a new sampling, you can click the Clear button—alternatively, use the context menu—to clear the data.
GETTING STARTED USING THE PROFILER ON INSTRUCTION LEVEL
To display instruction profiling information in the Disassembly window, follow these steps:
1 When you have built your application and started C-SPY, choose View>Disassembly to open the Disassembly window, and choose Enable from the context menu that is available when you right-click in the Profiler window.
2 Make sure that the Show command on the context menu is selected, to display the profiling information.
3 Start executing your application to collect the profiling information.
Category Setting
C/C++ Compiler Output>Generate debug information
Linker Output>Include debug information in output
Table 6: Project options for enabling the profiler
CSSTM8HW-2:Final
14
Using the profiler
IAR C-SPY® Hardware Debugger SystemsUser Guide for STM8
4 When the execution stops, for instance because the program exit is reached or a breakpoint is triggered, you can view instruction level profiling information in the left-hand margin of the Disassembly window.
Figure 8: Instruction count in Disassembly window
For each instruction, the number of times it has been executed is displayed.
RELATED REFERENCE INFORMATION
To use the profiler, you might need reference information about these windows:
● Function Profiler window, page 15
● Disassembly window; see the IAR Embedded Workbench® IDE User Guide● Trace Settings dialog box; see the online help system.
CSSTM8HW-2:Final
Hardware-specific debugging
15
FUNCTION PROFILER WINDOW
The Function Profiler window—available from the STice menu—displays function profiling information.
Figure 9: Function Profiler window
Toolbar
The toolbar at the top of the window provides these buttons:
Toolbar button Description
Enable/Disable Enables or disables the profiler.
Clear Clears all profiling data.
Save Opens a standard Save As dialog box where you can save the contents of the window to a file, with tab-separated columns. Only non-expanded rows are included in the list file.
Graphical view Overlays the values in the percentage columns with a graphical bar.
Progress bar Displays a backlog of profiling data that is still being processed. If the rate of incoming data is higher than the rate of the profiler processing the data, a backlog is accumulated. The progress bar indicates that the profiler is still processing data, but also approximately how far the profiler has come in the process. Note that because the profiler consumes data at a certain rate and the target system supplies data at another rate, the amount of data remaining to be processed can both increase and decrease. The progress bar can grow and shrink accordingly.
Table 7: Function Profiler window toolbar
CSSTM8HW-2:Final
16
Using the profiler
IAR C-SPY® Hardware Debugger SystemsUser Guide for STM8
The display area
The content in the display area depends on which source that is used for the profiling information:
The display area contains one line for each function compiled with debug information. When some profiling information has been collected, it is possible to expand rows of functions that have called other functions. The child items for a given function list all the functions that have been called by the parent function and the corresponding statistics.
More specifically, the display area provides this information:
Function Profiler window context menu
This context menu is available in the Function Profiler window:
Figure 10: Function Profiler window context menu
These commands are available on the menu:
Column Description
Function The name of the profiled C function.
Calls The number of times the function has been called.
Flat time The time in number of cycles spent inside the function.
Flat time (%) Flat time in number of cycles expressed as a percentage of the total time.
Acc. time The time in number of cycles spent in this function and everything called by this function.
Acc. time (%) Accumulated time in number of cycles expressed as a percentage of the total time.
Table 8: Function Profiler window columns
Menu command Description
Enable Enables the profiler. The system will collect information also when the window is closed.
Clear Clears all profiling data.
Table 9: Commands on the Function Profiler window context menu
CSSTM8HW-2:Final
Hardware-specific debugging
17
* Available sources depend on the C-SPY driver you are using.
Using breakpointsThis section provides an overview of the available breakpoints for the C-SPY hardware debugger systems. This is described:
● Available breakpoints, page 17
● Breakpoint Usage dialog box, page 18
● Advanced breakpoint dialog box, page 18.
For information about the various methods for setting breakpoints, the facilities for monitoring breakpoints, and the various breakpoint consumers, see the IAR Embedded Workbench® IDE User Guide.
AVAILABLE BREAKPOINTS
Using the C-SPY drivers for hardware debugger systems you can set code breakpoints, data breakpoints, and advanced breakpoints. The amount of breakpoints you can set depends on the number of hardware breakpoints available on the target system.
The number of code breakpoints you can set in RAM and flash memory is unlimited. Depending on your debugger system, the number of code breakpoints you can set in ROM might be limited.
This table summarizes the characteristics of breakpoints for the different target systems:
* The number of available code breakpoints in ROM is limited to 2.† The number of available data breakpoints and advanced breakpoints depends on the target system you are using.
Source* Selects which source to be used for the profiling information. Choose between:Builtin, not supported.Breakpoints, not supported.Trace, supported by the STice emulator.Sampling, not supported.
Menu command Description
Table 9: Commands on the Function Profiler window context menu (Continued)
Target system Code breakpoints Data breakpointsAdvanced
breakpoints
ST-LINK Unlimited* 1† 1†
STice Unlimited -- --
Table 10: Available breakpoints
CSSTM8HW-2:Final
18
Using breakpoints
IAR C-SPY® Hardware Debugger SystemsUser Guide for STM8
For information about code breakpoints and data breakpoints, see the IAR Embedded Workbench® IDE User Guide.
BREAKPOINT USAGE DIALOG BOX
The Breakpoint Usage dialog box—available from the driver-specific menu—lists all active breakpoints.
Figure 11: Breakpoint Usage dialog box
In addition to listing all breakpoints that you have defined, this dialog box also lists the internal breakpoints that the debugger is using.
For each breakpoint in the list the address and access type are shown. Each breakpoint in the list can also be expanded to show its originator.
For more information, see the IAR Embedded Workbench® IDE User Guide.
ADVANCED BREAKPOINT DIALOG BOX
The Advanced Breakpoint dialog box is available from the context menu that appears when you right-click in the View>Breakpoints window. On the context menu, choose New Breakpoint>Advanced Breakpoint to set a new breakpoint. Alternatively, to
CSSTM8HW-2:Final
Hardware-specific debugging
19
modify an existing breakpoint, select a breakpoint in the Breakpoint window and choose Edit on the context menu. The Advanced Breakpoint dialog box appears.
Figure 12: Advanced Breakpoint dialog box
Breakpoint type
An advanced breakpoint can be one of 10 types:
● Break on data value at a given address
● Break on operation code fetch within an address range
● Break on data access within an address range
● Break on operation code fetch outside an address range
● Break on data access outside an address range
● Break on two sequential operation code fetches
● Break on data access at one of two addresses
● Break on operation code fetch or data access at given addresses
● Break on stack write or operation code fetch at a given address
● Break on stack write or data access at a given address.
Depending on which breakpoint type you have chosen, different settings are available. Descriptions of the breakpoint types and their settings follow.
Break on data value at a given address
This breakpoint type breaks on the occurrence of a specific value at a specified data address.
CSSTM8HW-2:Final
20
Using breakpoints
IAR C-SPY® Hardware Debugger SystemsUser Guide for STM8
These are the settings for the breakpoint:
Break on operation code fetch within or outside an address range
These breakpoint types break on the occurrence of any operation code fetch within or outside of a specified address range, respectively.
These are the settings for both breakpoint types:
Break on data access within or outside an address range
These breakpoint types break on the occurrence of a data access within or outside a specified address range.
These are the settings for both breakpoint types:
Break on two sequential operation code fetches
This breakpoint type breaks when two operation code fetches have occurred in sequence; the occurrence of the first operation code fetch must precede the occurrence of the second operation code fetch.
These are the settings for the breakpoint:
Setting Description
Access mode Write, Read, Read/Write
Address The address where the value is stored
Data value The data value at the specified address
Table 11: Data address and value breakpoint
Setting Description
First address The first address of the range
Last address The last address of the range
Table 12: Range fetch within or outside an address range
Setting Description
Access mode Write, Read, Read/Write
First address The first address of the range
Last address The last address of the range
Table 13: Break on data access within or outside an address range
Setting Description
First address The address where the first operation code fetch must occur
Second address The address where the second operation code fetch must occur
Table 14: Sequential fetch at two addresses
CSSTM8HW-2:Final
Hardware-specific debugging
21
Break on data access at one of two addresses
This breakpoint breaks on the occurrence of a data access at either of two addresses.
These are the settings for the breakpoint:
Break on operation code fetch or data access at given addresses
This breakpoint type breaks either on the occurrence of an operation code fetch at a specified address, or the occurrence of a data access at a specified address.
These are the settings for the breakpoint:
Break on stack write or operation code fetch at a given address
This breakpoint type breaks on the occurrence of either a write operation to the stack below a specified address, or an operation code fetch at a specified address.
These are the settings for the breakpoint:
Break on stack write or data access at a given address
This breakpoint type breaks on the occurrence of either a write operation to the stack below a specified address, or a data access at a specified address.
Setting Description
Access mode Write, Read, Read/Write
First address The first of the two addresses
Second address The second of the two addresses
Table 15: Data access at one of two addresses
Setting Description
Access mode Write, Read, Read/Write
Fetch address The address where the operation code fetch must occur
Data address The address where the data access must occur
Table 16: Fetch at address or data access at address
Setting Description
Max stack address The maximum stack address below which the write operation must occur
Fetch address The address where the operation code fetch must occur
Table 17: Stack write or fetch at address
CSSTM8HW-2:Final
22
Resolving problems
IAR C-SPY® Hardware Debugger SystemsUser Guide for STM8
These are the settings for the breakpoint:
Resolving problemsDebugging using the C-SPY hardware debugger systems requires interaction between many systems, independent from each other. For this reason, setting up this debug system can be a complex task. If something goes wrong, it might at first be difficult to locate the cause of the problem.
This section includes suggestions for resolving the most common problems that can occur when debugging with the C-SPY hardware debugger systems.
For problems concerning the operation of the evaluation board, refer to the documentation supplied with it, or contact your hardware distributor.
WRITE FAILURE DURING LOAD
There are several possible reasons for write failure during load. The most common is that your application has been incorrectly linked:
● Check the contents of your linker configuration file and make sure that your application has not been linked to the wrong address
Viewing the map file might be of help when examining the linker output. For more information, see the IAR Embedded Workbench® IDE User Guide.
● Check that you are using the correct linker configuration file.
If you are using the IAR Embedded Workbench, the linker configuration file is automatically selected based on your choice of device:
● Choose Project>Options● Select the General Options category
● Click the Target tab
● Choose the appropriate device from the Device drop-down list.
To override the default linker configuration file:
● Choose Project>Options
Setting Description
Access mode Write, Read, Read/Write
Data address The address where the data access must occur
Max stack address The maximum stack address below which the write operation must occur
Table 18: Stack write or data access at address
CSSTM8HW-2:Final
Hardware-specific debugging
23
● Select the Linker category
● Click the Config tab
● Choose the appropriate linker command file in the Linker configuration file area.
NO CONTACT WITH THE TARGET HARDWARE
There are several possible reasons for C-SPY to fail to establish contact with the target hardware.
● Check the communication devices on your host computer
● Verify that the cable is properly plugged in and not damaged or of the wrong type
● Make sure that the evaluation board is connected to the power supply
CSSTM8HW-2:Final
24
Resolving problems
IAR C-SPY® Hardware Debugger SystemsUser Guide for STM8
CSSTM8HW-2:Final
Index
25
Aadvanced breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
break on data access within or outside an address range 20break on data value at a given address . . . . . . . . . . . . . . 19break on opcode fetch or data access at given addresses 21break on opcode fetch within or outside anaddress range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20break on stack write or data access at a given address . . 21break on stack write or opcode fetch at a given address . 21break on two sequential opcode fetches . . . . . . . . . . . . . 20data access at one of two addresses . . . . . . . . . . . . . . . . 21
assumptions, programming experience . . . . . . . . . . . . . . . . . v
Bbold style, in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . viiBreakpoint Usage dialog box (Simulator menu) . . . . . . . . . 18Breakpoints dialog box, Advanced Breakpoint . . . . . . . . . . 18breakpoints, hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Ccommand line options, typographic convention . . . . . . . . . viicommand prompt icon, in this guide . . . . . . . . . . . . . . . . . . viicomputer style, typographic convention . . . . . . . . . . . . . . . viiconventions, used in this guide . . . . . . . . . . . . . . . . . . . . . . vicopyright notice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iiC-SPY
differences between drivers . . . . . . . . . . . . . . . . . . . . . . . 1hardware debugger systems . . . . . . . . . . . . . . . . . . . . . . . 1
C-SPY driversSTice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2ST-LINK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4, 10
C++ terminology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
Ddebugger drivers
STice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2ST-LINK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4, 10
disclaimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iidocument conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . vidocumentation
other documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . vithis guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
Eedition, of this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
FFunction Profiler window . . . . . . . . . . . . . . . . . . . . . . . . . . 15
context menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Hhardware breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Iicons, in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viiitalic style, in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Llightbulb icon, in this guide. . . . . . . . . . . . . . . . . . . . . . . . . vii
Nnaming conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Index
CSSTM8HW-2:Final
26IAR C-SPY® Hardware Debugger SystemsUser Guide
Ooptions, hardware debugger systems. . . . . . . . . . . . . . . . . . . 7
Pparameters, typographic convention . . . . . . . . . . . . . . . . . . viipart number, of this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . iiprerequisites, programming experience. . . . . . . . . . . . . . . . . vprofiling
on function level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13on instruction level. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
profiling information, on functions and instructions . . . . . . 12programming experience. . . . . . . . . . . . . . . . . . . . . . . . . . . . vpublication date, of this guide . . . . . . . . . . . . . . . . . . . . . . . . ii
Rreference information, typographic convention. . . . . . . . . . viiregistered trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
SSTice (C-SPY driver) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
hardware installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
ST-LINK (C-SPY driver) . . . . . . . . . . . . . . . . . . . . . . . . 4, 10hardware installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Suppress (C-SPY option) . . . . . . . . . . . . . . . . . . . . . . . . 9, 11
Tterminology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vitools icon, in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . viitrademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iitypographic conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
UUse communication log file (C-SPY option). . . . . . . . . . 9, 11Use SWIM interface (C-SPY option) . . . . . . . . . . . . . . . . . . 9
VVerify (C-SPY option) . . . . . . . . . . . . . . . . . . . . . . . . . . 9, 11version, IAR Embedded Workbench. . . . . . . . . . . . . . . . . . . ii
Wwarnings icon, in this guide . . . . . . . . . . . . . . . . . . . . . . . . vii