EW430 DebuggingGuide
EW430 DebuggingGuide
UCS430-1
UCS430-1
COPYRIGHT NOTICE
Copyright © 1996–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.
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.
Texas Instruments is a registered trademark of Texas Instruments Incorporated.
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
First edition: November 2010
Part number: UCS430-1
This guide applies to version 5.20 and later of IAR Embedded Workbench® for Texas
Instruments’ MSP430 microcontroller family.
The C-SPY® Debugging Guide for MSP430 replaces all debugging information in the
IAR Embedded Workbench IDE User Guide for MSP430.
Internal reference: Too6.1, IJOA.
UCS430-1
Brief contents
Tables ...................................................................................................................... 13
Figures .................................................................................................................... 15
Preface .................................................................................................................... 19
UCS430-1
C-SPY® Debugging Guide
4 for MSP430
UCS430-1
Contents
Tables ...................................................................................................................... 13
Figures .................................................................................................................... 15
Preface .................................................................................................................... 19
UCS430-1
The IAR C-SPY Simulator .................................................................. 31
Features .............................................................................................. 31
Selecting the simulator driver ............................................................ 32
The C-SPY FET Debugger driver .................................................... 32
Features .............................................................................................. 32
Communication overview .................................................................. 33
Hardware installation ......................................................................... 34
UCS430-1
Contents
UCS430-1
Stack display .................................................................................... 121
Memory access checking ................................................................. 122
Reference information on memory and registers .................. 123
Collecting and using trace data ............................................................... 143
UCS430-1
Contents
UCS430-1
Simulating interrupts ..................................................................................... 191
UCS430-1
Contents
11
UCS430-1
C-SPY® Debugging Guide
12 for MSP430
UCS430-1
Tables
1: Typographic conventions used in this guide ......................................................... 23
2: Naming conventions used in this guide ................................................................ 23
3: Driver differences .................................................................................................. 30
4: C-SPY assembler symbols expressions ................................................................ 73
5: Handling name conflicts between hardware registers and assembler labels ......... 73
6: Effects of display format setting on different types of expressions .................... 79
7: Effects of display format setting on different types of expressions .................... 82
8: C-SPY macros for breakpoints .............................................................................. 96
9: Cycle counter registers ........................................................................................ 136
10: Project options for enabling the profiler ........................................................... 161
11: Project options for enabling code coverage ...................................................... 168
12: Sequencer settings - example ............................................................................ 180
13: State Storage Control settings—example .......................................................... 180
14: Cycle Counter 1, combinations of start, stop, and clear reactions .................... 189
15: Timer interrupt settings ..................................................................................... 197
16: Examples of C-SPY macro variables ................................................................ 214
17: C-SPY setup macros ......................................................................................... 218
18: Summary of system macros .............................................................................. 219
19: __cancelInterrupt return values ......................................................................... 221
20: __disableInterrupts return values ...................................................................... 222
21: __driverType return values ............................................................................... 223
22: __enableInterrupts return values ....................................................................... 223
23: __evaluate return values ................................................................................... 224
24: __isBatchMode return values ........................................................................... 224
25: __loadImage return values ................................................................................ 225
26: __openFile return values ................................................................................... 228
27: __readFile return values ................................................................................... 230
28: __setAdvancedTriggerBreak return values ....................................................... 234
29: __setCodeBreak return values .......................................................................... 235
30: __setConditionalBreak return values ................................................................ 236
31: __setDataBreak return values ........................................................................... 238
13
UCS430-1
32: __setLogBreak return values ............................................................................ 239
33: __setRangeBreak return values ........................................................................ 240
34: __setSimBreak return values ............................................................................ 241
35: __setTraceStartBreak return values .................................................................. 242
36: __setTraceStopBreak return values .................................................................. 243
37: __sourcePosition return values ......................................................................... 244
38: __unloadImage return values ............................................................................ 247
39: cspybat parameters ............................................................................................ 251
40: Options specific to the C-SPY drivers you are using ........................................ 269
UCS430-1
Figures
1: C-SPY and target systems ..................................................................................... 28
2: C-SPY FET Debugger communication overview ................................................. 33
3: Get Alternative File dialog box ............................................................................. 39
4: Example applications ............................................................................................ 42
5: Debug menu .......................................................................................................... 44
6: Images window ..................................................................................................... 47
7: Images window context menu ............................................................................... 48
8: Get Alternative File dialog box ............................................................................. 49
9: Device Information window ................................................................................. 50
10: C-SPY highlighting source location .................................................................... 55
11: C-SPY Disassembly window .............................................................................. 58
12: Disassembly window context menu .................................................................... 60
13: Call Stack window .............................................................................................. 62
14: Call Stack window context menu ........................................................................ 62
15: Terminal I/O window .......................................................................................... 63
16: Ctrl codes menu ................................................................................................... 64
17: Input Mode dialog box ........................................................................................ 64
18: Terminal I/O Log File dialog box ....................................................................... 64
19: LCD window ....................................................................................................... 65
20: LCD Settings dialog box ..................................................................................... 66
21: Debug Log window (message window) .............................................................. 66
22: Debug Log window context menu ...................................................................... 67
23: Log File dialog box ............................................................................................. 67
24: Report Assert dialog box ..................................................................................... 68
25: Autostep settings dialog box ............................................................................... 69
26: Viewing assembler variables in the Watch window ........................................... 76
27: Auto window ....................................................................................................... 77
28: Locals window .................................................................................................... 77
29: Watch window .................................................................................................... 78
30: Watch window context menu .............................................................................. 78
31: Live Watch window ............................................................................................ 79
15
UCS430-1
32: Statics window .................................................................................................... 80
33: Statics window context menu .............................................................................. 81
34: Select Statics dialog box ..................................................................................... 82
35: Quick Watch window .......................................................................................... 83
36: Symbols window ................................................................................................. 84
37: Symbols window context menu .......................................................................... 85
38: Resolve Symbol Ambiguity dialog box .............................................................. 85
39: Breakpoint icons .................................................................................................. 90
40: Modifying breakpoints via the context menu ...................................................... 95
41: Breakpoints window ............................................................................................ 98
42: Breakpoints window context menu ..................................................................... 99
43: Breakpoint Usage dialog box ............................................................................ 100
44: Code breakpoints dialog box ............................................................................. 101
45: Log breakpoints dialog box ............................................................................... 103
46: Data breakpoints dialog box .............................................................................. 104
47: Immediate breakpoints dialog box .................................................................... 106
48: Range breakpoints dialog box ........................................................................... 107
49: Conditional breakpoints dialog box .................................................................. 109
50: Advanced trigger dialog box ............................................................................. 112
51: Enter Location dialog box ................................................................................. 114
52: Breakpoint combiner dialog box ....................................................................... 115
53: Resolve Source Ambiguity dialog box ............................................................. 116
54: Zones in C-SPY ................................................................................................. 121
55: Memory window ............................................................................................... 123
56: Memory window context menu ........................................................................ 125
57: Memory Save dialog box .................................................................................. 127
58: Memory Restore dialog box .............................................................................. 128
59: Fill dialog box ................................................................................................... 128
60: Symbolic Memory window ............................................................................... 130
61: Symbolic Memory window context menu ........................................................ 131
62: Stack window .................................................................................................... 132
63: Stack window context menu ............................................................................. 134
64: Register window ................................................................................................ 135
65: Memory Access Setup dialog box ..................................................................... 137
UCS430-1
Figures
17
UCS430-1
100: FET Debugger setup options ........................................................................... 275
101: FET Debugger download options ................................................................... 277
102: FET Debugger breakpoints options ................................................................ 278
103: Simulator setup options ................................................................................... 279
104: Simulator menu ............................................................................................... 281
105: The Emulator menu ......................................................................................... 283
106: General Clock Control dialog box .................................................................. 285
107: Extended Clock Control dialog box ................................................................ 286
UCS430-1
Preface
Welcome to the C-SPY® Debugging Guide for MSP430. The purpose of this
guide is to help you fully use the features in the IAR C-SPY® Debugger for
debugging your application based on the MSP430 microcontroller.
19
UCS430-1
What this guide contains
We also recommend the Glossary which you can find in the IDE Project Management
and Building Guide if you should encounter any unfamiliar terms in the IAR Systems
user and reference guides.
UCS430-1
Preface
Other documentation
User documentation is available as hypertext PDFs and as a context-sensitive online
help system in HTML format. You can access the documentation from the Information
Center or from the Help menu in the IAR Embedded Workbench IDE. The online help
system is also available via the F1 key.
21
UCS430-1
Document conventions
● Using the IAR CLIB Library, refer to the IAR C Library Functions Reference
Guide, available in the online help system.
● Porting application code and projects created with a previous version of IAR
Embedded Workbench for MSP430, refer to the IAR Embedded Workbench®
Migration Guide for MSP430.
● Developing safety-critical applications using the MISRA C guidelines, refer to the
IAR Embedded Workbench® MISRA C:2004 Reference Guide or the IAR Embedded
Workbench® MISRA C:1998 Reference Guide.
Note: Additional documentation might be available depending on your product
installation.
WEB SITES
Recommended web sites:
● The Texas Instruments web site, [Link], contains information and news about
the MSP430 microcontrollers.
● The IAR Systems web site, [Link], holds application notes and other
product information.
● Finally, the Embedded C++ Technical Committee web site,
[Link]/ec2plus, contains information about the Embedded C++
standard.
Document conventions
When, in this text, we refer to the programming language C, the text also applies to C++,
unless otherwise stated.
UCS430-1
Preface
When referring to a directory in your product installation, for example 430\doc, the full
path to the location is assumed, for example c:\Program Files\IAR
Systems\Embedded Workbench 6.n\430\doc.
TYPOGRAPHIC CONVENTIONS
This guide uses the following typographic conventions:
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] An optional part of a command with alternatives.
{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.
NAMING CONVENTIONS
The following naming conventions are used for the products and tools from IAR
Systems® referred to in this guide:
Brand name Generic term
IAR Embedded Workbench® for MSP430 IAR Embedded Workbench®
IAR Embedded Workbench® IDE for MSP430 the IDE
Table 2: Naming conventions used in this guide
23
UCS430-1
Document conventions
UCS430-1
The IAR C-SPY Debugger
This chapter introduces you to the IAR C-SPY® Debugger and to the
concepts that are related to debugging in general and to C-SPY in particular.
The chapter also introduces the various C-SPY drivers. More specifically, this
means:
● Introduction to C-SPY
● Debugger concepts
Introduction to C-SPY
This section covers these topics:
● An integrated environment
● General C-SPY debugger features
● RTOS awareness.
AN INTEGRATED ENVIRONMENT
C-SPY is a high-level-language debugger for embedded applications. It is designed for
use with the IAR Systems compilers and assemblers, and is completely integrated in the
IDE, providing development and debugging within the same application. This will give
you possibilities such as:
● Editing while debugging. During a debug session, you can make corrections directly
in the same source code window that is used for control the debugging. Changes
will be included in the next project rebuild.
● Setting breakpoints at any point during the development cycle. You can inspect and
modify breakpoint definitions also when the debugger is not running, and
breakpoint definitions flow with the text as you edit. Your debug settings, such as
watch properties, window layouts, and register groups will be preserved between
your debug sessions.
25
UCS430-1
Introduction to C-SPY
All windows that are open in the Embedded Workbench workspace will stay open when
you start the C-SPY Debugger. In addition, a set of C-SPY-specific windows are opened.
UCS430-1
The IAR C-SPY Debugger
program counter is. You can select any function in the call stack, and for each
function you get valid information for local variables and available registers.
● Powerful macro system
C-SPY includes a powerful internal macro system, to allow you to define complex
sets of actions to be performed. C-SPY macros can be used on their own or in
conjunction with complex breakpoints and—if you are using the simulator—the
interrupt simulation system to perform a wide variety of tasks.
RTOS AWARENESS
C-SPY supports real-time OS aware debugging.
These RTOSes are supported:
● IAR PowerPac
● Segger embOS
● Micrium μC/OS-II
● OSEK.
RTOS plugin modules can be provided by IAR Systems, and by third-party suppliers.
Contact your software distributor or IAR Systems representative, alternatively visit the
IAR Systems web site, for information about supported RTOS modules.
Provided that one or more real-time operating system plugin modules are supported for
the IAR Embedded Workbench version you are using, you can load one for use with
C-SPY. A C-SPY RTOS awareness plugin module gives you a high level of control and
visibility over an application built on top of a real-time operating system. It displays
27
UCS430-1
Debugger concepts
RTOS-specific items like task lists, queues, semaphores, mailboxes, and various RTOS
system variables. Task-specific breakpoints and task-specific stepping make it easier to
debug tasks.
A loaded plugin will add its own menu, set of windows, and buttons when a debug
session is started (provided that the RTOS is linked with the application). For
information about other RTOS awareness plugin modules, refer to the manufacturer of
the plugin module.
Debugger concepts
This section introduces some of the concepts and terms that are related to debugging in
general and to C-SPY in particular. This section does not contain specific information
related to C-SPY features. Instead, you will find such information in each chapter of this
part of the documentation. The IAR Systems user documentation uses the terms
described in this section when referring to these concepts.
UCS430-1
The IAR C-SPY Debugger
Note: In IAR Embedded Workbench for MSP430, there are no ROM-monitor drivers.
THE DEBUGGER
The debugger, for instance C-SPY, is the program that you use for debugging your
applications on a target system.
THE APPLICATION
A user application is the software you have developed and which you want to debug
using C-SPY.
29
UCS430-1
C-SPY drivers overview
THIRD-PARTY DEBUGGERS
You can use a third-party debugger together with the IAR Systems toolchain as long as
the third-party debugger can read any of the output formats provided by XLINK, such
as UBROF, ELF/DWARF, COFF, Intel-extended, Motorola, or any other available
format. For information about which format to use with a third-party debugger, see the
user documentation supplied with that tool.
UCS430-1
The IAR C-SPY Debugger
FEATURES
In addition to the general features in C-SPY, the simulator also provides:
● Instruction-level simulation
● Memory configuration and validation
● Interrupt simulation
● Peripheral simulation (using the C-SPY macro system in conjunction with
immediate breakpoints).
31
UCS430-1
The C-SPY FET Debugger driver
FEATURES
In addition to the general features of C-SPY, the FET Debugger driver also provides:
● Execution in real time with full access to the microcontroller
● High-speed communication through a JTAG interface
● Zero memory footprint on the target system
● Hardware code breakpoints
● Built-in flash loader.
Depending on the level of Enhanced Emulation Module (EEM) support, you might have
access also to:
● State storage
UCS430-1
The IAR C-SPY Debugger
● Sequencer
● Clock control
● Advanced cycle counter.
Note: Code coverage, function level profiling, and live watch are not supported by the
C-SPY FET Debugger driver.
COMMUNICATION OVERVIEW
The C-SPY FET Debugger driver uses the USB or parallel port to communicate with the
FET Interface module. The FET Interface module communicates with the JTAG
interface on the hardware.
For further information, refer to the documentation supplied with the FET Debugger.
When a debugging session is started, your application is automatically downloaded and
programmed into flash memory. You can disable this feature, if necessary.
33
UCS430-1
The C-SPY FET Debugger driver
HARDWARE INSTALLATION
For information about the hardware installation, see the documentation supplied with
the FET Debugger from Texas Instruments. The following power-up sequence is
recommended to ensure proper communication between the target board, FET
Debugger, and C-SPY:
1 Power up the target board.
2 Power up FET Debugger.
3 Start the C-SPY debugging session.
UCS430-1
Getting started using
C-SPY
This chapter helps you get started using C-SPY®. More specifically, this means:
● Setting up C-SPY
● Starting C-SPY
Setting up C-SPY
This section describes the steps involved for setting up C-SPY.
More specifically, you will get information about:
● Setting up for debugging
● Executing from reset
● Using a setup macro file
● Selecting a device description file
● Loading plugin modules.
35
UCS430-1
Setting up C-SPY
UCS430-1
Getting started using C-SPY
2 Select Use macro file and type the path and name of your setup macro file, for
example [Link]. If you do not type a filename extension, the extension mac is
assumed.
Starting C-SPY
When you have set up the debugger, you are ready to start a debug session; this section
describes the steps involved.
More specifically, you will get information about:
● Starting the debugger
● Loading executable files built outside of the IDE
● Starting a debug session with source files missing
● Loading multiple images.
37
UCS430-1
Starting C-SPY
UCS430-1
Getting started using C-SPY
However, if C-SPY cannot automatically find the source files, for example if the
application was built on another computer, the Get Alternative File dialog box is
displayed:
39
UCS430-1
Adapting for target hardware
If more than one image has been loaded, you will have access to the combined debug
information for all the loaded images. In the Images window you can choose whether
you want to have access to debug information for one image or for all images.
To load additional images at C-SPY startup:
1 Choose Project>Options>Debugger>Images and specify up to three additional
images to be loaded. For more information, see Images, page 272.
2 Start the debug session.
To load additional images at a specific moment:
Use the __loadImage system macro and execute it using either one of the methods
described in Procedures for using C-SPY macros, page 207.
To display a list of loaded images:
Choose Images from the View menu. The Images window is displayed, see Images
window, page 47.
UCS430-1
Getting started using C-SPY
that the format of these descriptions might be updated in future upgrade versions of the
product.
Make a copy of the device description file that best suits your needs, and modify it
according to the description in the file.
For information about how to load a device description file, see Selecting a device
description file, page 37.
Because the built-in execUserPreload setup macro function is used, your macro
function will be executed directly after the communication with the target system is
established but before C-SPY downloads your application.
2 Save the file with the filename extension mac.
3 Before you start C-SPY, choose Project>Options>Debugger and click the Setup tab.
4 Select the option Use Setup file and choose the macro file you just created.
Your setup macro will now be loaded during the C-SPY startup sequence.
41
UCS430-1
Running example projects
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 msp430\FET_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 other related files.
UCS430-1
Getting started using C-SPY
For further details about the C-SPY options and how to configure C-SPY to interact with
the target board, see Debugger options, page 269.
Click OK to close the project 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 Download and Debug button. If
C-SPY fails to establish contact with the target system, see Resolving problems, page
286.
8 Choose Execute>Go or click the Go button to start the application.
Click the Stop button to stop execution.
43
UCS430-1
Reference information on starting C-SPY
Menu bar
These menus are available when C-SPY is running:
Debug menu
The Debug menu is available when C-SPY is running. The Debug menu provides
commands for executing and debugging the source application. Most of the commands
are also available as icon buttons on the debug toolbar.
UCS430-1
Getting started using C-SPY
45
UCS430-1
Reference information on starting C-SPY
Macros Displays a dialog box where you can list, register, and edit
your macro files and functions; see Using the Macro
Configuration dialog box, page 209.
Logging>Set Log file Displays a dialog box where you can choose to log the
contents of the Debug Log window to a file. You can select
the type and the location of the log file. You can choose
what you want to log: errors, warnings, system
information, user messages, or all of these. See Log File
dialog box, page 67.
Logging> Displays a dialog box where you can choose to log
Set Terminal I/O Log file simulated target access communication to a file. You can
select the destination of the log file. See Terminal I/O Log
File dialog box, page 64.
C-SPY windows
These windows specific to C-SPY are available when C-SPY is running:
● C-SPY Debugger main window
● Disassembly window
● Memory window
● Symbolic Memory window
● Register window
● Watch window
● Locals window
● Auto window
● Live Watch window
● Quick Watch window
● Statics window
● Call Stack window
● Trace window
● Function Trace window
● Timeline window
● Terminal I/O window
● LCD window
● Code Coverage window
● Function Profiler window
UCS430-1
Getting started using C-SPY
● Images window
● Stack window
● Symbols window.
Additional windows are available depending on which C-SPY driver you are using.
In windows where you can edit the Expression field, you can specify the number of
elements to be displayed in the field by adding a semicolon followed by an integer. For
example, to display only the three first elements of an array named myArray, or three
elements in sequence starting with the element pointed to by a pointer, write:
myArray;3
Optionally, add a comma and another integer that specifies which element to start with.
For example, to display elements 10–14, write:
myArray;5,10
Images window
The Images window is available from the View menu.
The Images window lists all currently loaded images (debug files).
47
UCS430-1
Reference information on starting C-SPY
Normally, a source application consists of exactly one image that you debug. However,
you can also load additional images. This means that the complete debuggable unit
consists of several images.
Display area
This area lists the loaded images in these columns:
C-SPY can either use debug information from all of the loaded images simultaneously,
or from one image at a time. Double-click on a row to show information only for that
image. The current choice is highlighted.
Context menu
This context menu is available:
Show all images Shows debug information for all loaded debug images.
Show only image Shows debug information for the selected debug image.
Related information
For related information, see:
● Loading multiple images, page 39
● Images, page 272
● __loadImage, page 225.
UCS430-1
Getting started using C-SPY
Suggested alternative
Specify an alternative file.
Skip
C-SPY will assume that the source file is not available for this debug session.
Related information
For related information, see Starting a debug session with source files missing, page 38.
49
UCS430-1
Reference information on starting C-SPY
UCS430-1
Executing your application
This chapter contains information about executing your application in
C-SPY®. More specifically, this means:
51
UCS430-1
Introduction to application execution
code. In the editor windows you can execute the application one statement at a time
while monitoring the values of variables and data structures.
Disassembly mode debugging lets you focus on the critical sections of your application,
and provides you with precise control of the application code. You can open a
disassembly window which displays a mnemonic assembler listing of your application
based on actual memory contents rather than source code, and lets you execute the
application exactly one machine instruction at a time.
Regardless of which mode you are debugging in, you can display registers and memory,
and change their contents.
SINGLE STEPPING
C-SPY allows more stepping precision than most other debuggers because it is not
line-oriented but statement-oriented. The compiler generates detailed stepping
information in the form of step points at each statement, and at each function call. That
is, source code locations where you might consider whether to execute a step into or a
step over command. Because the step points are located not only at each statement but
also at each function call, the step functionality allows a finer granularity than just
stepping on statements. There are four step commands:
● Step Into
● Step Over
● Next Statement
● Step Out.
Using the Autostep settings dialog box, you can automate the single stepping. For more
information, see Autostep settings dialog box, page 69.
Consider this example and assume that the previous step has taken you to the f(i)
function call (highlighted):
extern int g(int);
int f(int n)
{
value = g(n-1) + g(n-2) + g(n-3);
return value;
}
int main()
{
...
f(i);
value ++;
}
UCS430-1
Executing your application
Step Into
While stepping, you typically consider whether to step into a function and continue
stepping inside the function or subroutine. The Step Into command takes you to the first
step point within the subroutine, g(n-1):
extern int g(int);
int f(int n)
{
value = g(n-1) + g(n-2) + g(n-3);
return value;
}
The Step Into command executes to the next step point in the normal flow of control,
regardless of whether it is in the same or another function.
Step Over
The Step Over command executes to the next step point in the same function, without
stopping inside called functions. The command would take you to the g(n-2) function
call, which is not a statement on its own but part of the same statement as g(n-1). Thus,
you can skip uninteresting calls which are parts of statements and instead focus on
critical parts:
extern int g(int);
int f(int n)
{
value = g(n-1) + g(n-2) + g(n-3);
return value;
}
Next Statement
The Next Statement command executes directly to the next statement, in this case
return value, allowing faster stepping:
53
UCS430-1
Introduction to application execution
Step Out
When inside the function, you can—if you wish—use the Step Out command to step
out of it before it reaches the exit. This will take you directly to the statement
immediately after the function call:
extern int g(int);
int f(int n)
{
value = g(n-1) + g(n-2) g(n-3);
return value;
}
int main()
{
...
f(i);
value ++;
}
The possibility of stepping into an individual function that is part of a more complex
statement is particularly useful when you use C code containing many nested function
calls. It is also very useful for C++, which tends to have many implicit function calls,
such as constructors, destructors, assignment operators, and other user-defined
operators.
This detailed stepping can in some circumstances be either invaluable or unnecessarily
slow. For this reason, you can also step only on statements, which means faster stepping.
Go
The Go command continues execution from the current position until a breakpoint or
program exit is reached.
UCS430-1
Executing your application
Run to Cursor
The Run to Cursor command executes to the position in the source code where you
have placed the cursor. The Run to Cursor command also works in the Disassembly
window and in the Call Stack window.
HIGHLIGHTING
At each stop, C-SPY highlights the corresponding C or C++ source or instruction with
a green color, in the editor and the Disassembly window respectively. In addition, a
green arrow appears in the editor window when you step on C or C++ source level, and
in the Disassembly window when you step on disassembly level. This is determined by
which of the windows is the active window. If none of the windows are active, it is
determined by which of the windows was last active.
For simple statements without function calls, the whole statement is typically
highlighted. When stopping at a statement with function calls, C-SPY highlights the first
call because this illustrates more clearly what Step Into and Step Over would mean at
that time.
Occasionally, you will notice that a statement in the source window is highlighted using
a pale variant of the normal highlight color. This happens when the program counter is
at an assembler instruction which is part of a source statement but not exactly at a step
point. This is often the case when stepping in the Disassembly window. Only when the
program counter is at the first instruction of the source statement, the ordinary highlight
color is used.
55
UCS430-1
Introduction to application execution
The Call Stack window shows a list of function calls, with the current function at the
top. When you inspect a function in the call chain, the contents of all affected windows
are updated to display the state of that particular call frame. This includes the editor,
Locals, Register, Watch and Disassembly windows. A function would normally not
make use of all registers, so these registers might have undefined states and be displayed
as dashes (---).
In the editor and Disassembly windows, a green highlight indicates the topmost, or
current, call frame; a yellow highlight is used when inspecting other frames.
For your convenience, it is possible to select a function in the call stack and click the
Run to Cursor command to execute to that function.
Assembler source code does not automatically contain any backtrace information. To
see the call chain also for your assembler modules, you can add the appropriate CFI
assembler directives to the assembler source code. For further information, see the
MSP430 IAR Assembler Reference Guide.
DEBUG LOGGING
The Debug Log window displays debugger output, such as diagnostic messages,
macro-generated output, event log messages, and information about trace.
It can sometimes be convenient to log the information to a file where you can easily
inspect it. The two main advantages are:
● The file can be opened in another tool, for instance an editor, so you can navigate
and search within the file for particularly interesting parts
● The file provides history about how you have controlled the execution, for instance,
which breakpoints that have been triggered etc.
UCS430-1
Executing your application
57
UCS430-1
Reference information on application execution
Disassembly window
The C-SPY Disassembly window is available from the View menu.
Toggle embedded
Go to memory address Zone display source mode
Code coverage
information
Current position
Breakpoint
This window shows the application being debugged as disassembled application code.
To change the default color of the source code in the Disassembly window:
1 Choose Tools>Options>Debugger.
2 Set the default color using the Source code coloring in disassembly window option.
To view the corresponding assembler code for a function, you can select it in the editor
window and drag it to the Disassembly window.
Toolbar
The toolbar contains:
UCS430-1
Executing your application
Display area
The display area shows the disassembled application code.
This area contains these graphic elements:
Green highlight Indicates the current position, that is the next assembler
instruction to be executed. To move the cursor to any line in
the Disassembly window, click the line. Alternatively, move
the cursor using the navigation keys.
Yellow highlight Indicates inspection of other frames, that is the next
assembler instruction to be executed upon return to this
frame
Red dot Indicates a breakpoint. Double-click in the gray left-side
margin of the window to set a breakpoint. For more
information, see Using breakpoints, page 87.
Green diamond Indicates code that has been executed—that is, code
coverage.
If instruction profiling has been enabled from the context menu, an extra column in the
left-side margin appears with information about how many times each instruction has
been executed.
59
UCS430-1
Reference information on application execution
Context menu
This context menu is available:
Note: The contents of this menu are dynamic, which means it might look different
depending on your product package.
These commands are available:
UCS430-1
Executing your application
61
UCS430-1
Reference information on application execution
This window displays the C function call stack with the current function at the top. To
inspect a function call, double-click it. C-SPY now focuses on that call frame instead.
If the next Step Into command would step to a function call, the name of the function
is displayed in the grey bar at the top of the window. This is especially useful for implicit
function calls, such as C++ constructors, destructors, and operators.
Display area
Provided that the command Show Arguments is enabled, each entry in the display area
has the format:
function(values)
where (values) is a list of the current value of the parameters, or empty if the function
does not take any parameters.
Context menu
This context menu is available:
UCS430-1
Executing your application
Use this window to enter input to your application, and display output from it.
To use this window, you must:
1 Link your application with the option With I/O emulation modules.
C-SPY will then direct stdin, stdout and stderr to this window. If the Terminal I/O
window is closed, C-SPY will open it automatically when input is required, but not for
output.
63
UCS430-1
Reference information on application execution
Input
Type the text that you want to input to your application.
Ctrl codes
Opens a menu for input of special characters, such as EOF (end of file) and NUL.
Input Mode
Opens the Input Mode dialog box where you choose whether to input data from the
keyboard or from a file.
For reference information about the options available in this dialog box, see Terminal
I/O options in IDE Project Management and Building Guide.
UCS430-1
Executing your application
Use this dialog box to select a destination log file for terminal I/O from C-SPY.
LCD window
The LCD window is available from the View menu.
Toolbar
Displays the LCD Settings dialog box, where you can configure the LCD window.
65
UCS430-1
Reference information on application execution
UCS430-1
Executing your application
Context menu
This context menu is available:
67
UCS430-1
Reference information on application execution
Include
The information printed in the file is, by default, the same as the information listed in
the Log window. To change the information logged, choose between:
Use the browse button, to override the default file and location of the log file (the default
filename extension is log).
Abort
The application stops executing and the runtime library function abort, which is part
of your application on the target system, will be called. This means that the application
itself terminates its execution.
Debug
C-SPY stops the execution of the application and returns control to you.
UCS430-1
Executing your application
Ignore
The assertion is ignored and the application continues to execute.
Delay
Specify the delay between each step in milliseconds.
69
UCS430-1
Reference information on application execution
UCS430-1
Working with variables
and expressions
This chapter describes how variables and expressions can be used in C-SPY®.
More specifically, this means:
71
UCS430-1
Introduction to working with variables and expressions
● The Statics window displays the values of variables with static storage duration. The
window is automatically updated when execution stops.
● The Quick Watch window gives you precise control over when to evaluate an
expression.
● The Symbols window displays all symbols with a static location, that is, C/C++
functions, assembler labels, and variables with static storage duration, including
symbols from the runtime library.
● The Trace-related windows let you inspect the program flow up to a specific state.
For more information, see Collecting and using trace data, page 143.
C-SPY EXPRESSIONS
C-SPY expressions can include any type of C expression, except for calls to functions.
The following types of symbols can be used in expressions:
● C/C++ symbols
● Assembler symbols (register names and assembler labels)
● C-SPY macro functions
● C-SPY macro variables.
UCS430-1
Working with variables and expressions
Expressions that are built with these types of symbols are called C-SPY expressions and
there are several methods for monitoring these in C-SPY. Examples of valid C-SPY
expressions are:
i + j
i = 42
#asm_label
#R2
#PC
my_macro_func(19)
C/C++ symbols
C symbols are symbols that you have defined in the C source code of your application,
for instance variables, constants, and functions (functions can be used as symbols but
cannot be executed). C symbols can be referenced by their names. Note that C++
symbols might implicitly contain function calls which are not allowed in C-SPY
symbols and expressions.
Assembler symbols
Assembler symbols can be assembler labels or register names. That is, general purpose
registers, such as R4–R15, and special purpose registers, such as the program counter
and the status register. If a device description file is used, all memory-mapped peripheral
units, such as I/O ports, can also be used as assembler symbols in the same way as the
CPU registers. See Modifying a device description file, page 40.
Assembler symbols can be used in C-SPY expressions if they are prefixed by #.
Example What it does
#pc++ Increments the value of the program counter.
myptr = #label7 Sets myptr to the integral address of label7 within its zone.
Table 4: C-SPY assembler symbols expressions
In case of a name conflict between a hardware register and an assembler label, hardware
registers have a higher precedence. To refer to an assembler label in such a case, you
must enclose the label in back quotes ` (ASCII character 0x60). For example:
Example What it does
#pc Refers to the program counter.
#`pc` Refers to the assembler label pc.
Table 5: Handling name conflicts between hardware registers and assembler labels
Which processor-specific symbols are available by default can be seen in the Register
window, using the CPU Registers register group. See Register window, page 135.
73
UCS430-1
Introduction to working with variables and expressions
Using sizeof
According to standard C, there are two syntactical forms of sizeof:
sizeof(type)
sizeof expr
Effects of optimizations
The compiler is free to optimize the application software as much as possible, as long
as the expected behavior remains. The optimization can affect the code so that
debugging might be more difficult because it will be less clear how the generated code
relates to the source code. Typically, using a high optimization level can affect the code
in a way that will not allow you to view a value of a variable as expected.
UCS430-1
Working with variables and expressions
From the point where the variable i is declared until it is actually used, the compiler
does not need to waste stack or register space on it. The compiler can optimize the code,
which means that C-SPY will not be able to display the value until it is actually used. If
you try to view the value of a variable that is temporarily unavailable, C-SPY will
display the text:
Unavailable
If you need full information about values of variables during your debugging session,
you should make sure to use the lowest optimization level during compilation, that is,
None.
75
UCS430-1
Reference information on working with variables and expressions
In this figure, you can see four variables in the Watch window and their corresponding
declarations in the assembler source file to the left:
Note that asmvar4 is displayed as an int, although the original assembler declaration
probably intended for it to be a single byte quantity. From the context menu you can
make C-SPY display the variable as, for example, an 8-bit unsigned variable. This has
already been specified for the asmvar3 variable.
UCS430-1
Working with variables and expressions
For trace-related reference information, see Reference information on trace, page 146.
Auto window
The Auto window is available from the View menu.
This window displays a useful selection of variables and expressions in, or near, the
current statement. Every time execution in C-SPY stops, the values in the Auto window
are recalculated. Values that have changed since the last stop are highlighted in red.
Context menu
For a description of the context menu, see Watch window, page 78.
Locals window
The Locals window is available from the View menu.
This window displays the local variables and parameters for the current function. Every
time execution in C-SPY stops, the values in the Locals window are recalculated. Values
that have changed since the last stop are highlighted in red.
77
UCS430-1
Reference information on working with variables and expressions
Context menu
For a description of the context menu, see Watch window, page 78.
Watch window
The Watch window is available from the View menu.
Use this window to monitor the values of C-SPY expressions or variables. You can view,
add, modify, and remove expressions. Tree structures of arrays, structs, and unions are
expandable, which means that you can study each item of these.
Every time execution in C-SPY stops, the values in the Watch window are recalculated.
Values that have changed since the last stop are highlighted in red.
Context menu
This context menu is available:
UCS430-1
Working with variables and expressions
The display format setting affects different types of expressions in these ways:
79
UCS430-1
Reference information on working with variables and expressions
This window repeatedly samples and displays the value of expressions while your
application is executing. Variables in the expressions must be statically located, such as
global variables.
This window can only be used for hardware target systems supporting this feature.
Context menu
For a description of the context menu, see Watch window, page 78.
In addition, the menu contains the Options command, which opens the Debugger
dialog box where you can set the Update interval option. The default value of this
option is 1000 milliseconds, which means the Live Watch window will be updated once
every second during program execution.
Statics window
The Statics window is available from the View menu.
UCS430-1
Working with variables and expressions
This window displays the values of variables with static storage duration, typically that
is variables with file scope but also static variables in functions and classes. Note that
volatile declared variables with static storage duration will not be displayed.
Every time execution in C-SPY stops, the values in the Statics window are recalculated.
Values that have changed since the last stop are highlighted in red.
Display area
This area contains these columns:
Expression The name of the variable. The base name of the variable is
followed by the full name, which includes module, class, or
function scope. This column is not editable.
Value The value of the variable. Values that have changed are
highlighted in red. This column is editable.
Location The location in memory where this variable is stored.
Type The data type of the variable.
Context menu
This context menu is available:
81
UCS430-1
Reference information on working with variables and expressions
Select Statics Displays a dialog box where you can select a subset of
variables to be displayed in the Statics window, see Select
Statics dialog box, page 82.
The display format setting affects different types of expressions in these ways:
Use this dialog box to select which variables should be displayed in the Statics window.
UCS430-1
Working with variables and expressions
Use this window to watch the value of a variable or expression and evaluate expressions
at a specific point in time.
In contrast to the Watch window, the Quick Watch window gives you precise control
over when to evaluate the expression. For single variables this might not be necessary,
but for expressions with possible side effects, such as assignments and C-SPY macro
functions, it allows you to perform evaluations under controlled conditions.
To evaluate an expression:
1 In the editor window, right-click on the expression you want to examine and choose
Quick Watch from the context menu that appears.
2 The expression will automatically appear in the Quick Watch window.
Alternatively:
1 In the Quick Watch window, type the expression you want to examine in the
Expressions text box.
2 Click the Recalculate button to calculate the value of the expression.
For an example, see Executing macros using Quick Watch, page 211.
83
UCS430-1
Reference information on working with variables and expressions
Context menu
For a description of the context menu, see Watch window, page 78.
In addition, the menu contains the Add to Watch window command, which adds the
selected expression to the Watch window.
Symbols window
The Symbols window is available from the View menu.
This window displays all symbols with a static location, that is, C/C++ functions,
assembler labels, and variables with static storage duration, including symbols from the
runtime library.
Display area
This area contains these columns:
Click the column headers to sort the list by symbol name, location, or full name.
UCS430-1
Working with variables and expressions
Context menu
This context menu is available:
Ambiguous symbol
Indicates which symbol that is ambiguous.
85
UCS430-1
Reference information on working with variables and expressions
UCS430-1
Using breakpoints
This chapter describes breakpoints and the various ways to define and
monitor them. More specifically, this means:
87
UCS430-1
Introduction to setting and using breakpoints
BREAKPOINT TYPES
Depending on the C-SPY driver you are using, C-SPY supports different types of
breakpoints.
Code breakpoints
Code breakpoints are used for code locations to investigate whether your program logic
is correct or to get trace printouts. Code breakpoints are triggered when an instruction is
fetched from the specified location. If you have set the breakpoint on a specific machine
instruction, the breakpoint will be triggered and the execution will stop, before the
instruction is executed.
Log breakpoints
Log breakpoints provide a convenient way to add trace printouts without having to add
any code to your application source code. Log breakpoints are triggered when an
instruction is fetched from the specified location. If you have set the breakpoint on a
specific machine instruction, the breakpoint will be triggered and the execution will
temporarily stop and print the specified message in the C-SPY Debug Log window.
Trace breakpoints
Trace Start and Stop breakpoints start and stop trace data collection—a convenient way
to analyze instructions between two execution points.
UCS430-1
Using breakpoints
Data breakpoints
Data breakpoints are primarily useful for variables that have a fixed address in memory.
If you set a breakpoint on an accessible local variable, the breakpoint is set on the
corresponding memory location. The validity of this location is only guaranteed for
small parts of the code. Data breakpoints are triggered when data is accessed at the
specified location. The execution will usually stop directly after the instruction that
accessed the data has been executed.
Immediate breakpoints
The C-SPY Simulator lets you set immediate breakpoints, which will halt instruction
execution only temporarily. This allows a C-SPY macro function to be called when the
simulated processor is about to read data from a location or immediately after it has
written data. Instruction execution will resume after the action.
This type of breakpoint is useful for simulating memory-mapped devices of various
kinds (for instance serial ports and timers). When the simulated processor reads from a
memory-mapped location, a C-SPY macro function can intervene and supply
appropriate data. Conversely, when the simulated processor writes to a memory-mapped
location, a C-SPY macro function can act on the value that was written.
Range breakpoints
Range breakpoints can be set on a data or an address range, and the action can be
specified to occur on an access inside or outside the specified range. These breakpoints
are only available if you are using a device that supports the Enhanced Emulation
Module at the required level.
Conditional breakpoints
Conditional breakpoints can be set with various operators on the address bus, the data
bus, or on a register, to be triggered by a certain kind of access. You can also specify a
conditional value. These breakpoints are only available if you are using a device that
supports the Enhanced Emulation Module at the required level.
89
UCS430-1
Introduction to setting and using breakpoints
BREAKPOINT ICONS
A breakpoint is marked with an icon in the left margin of the editor window. The icon
varies with the type of breakpoint:
Code breakpoint
Log breakpoint
Tooltip information
Disabled code
breakpoint
If the breakpoint icon does not appear, make sure the option Show bookmarks is
selected, see Editor options in the IDE Project Management and Building Guide.
Just point at the breakpoint icon with the mouse pointer to get detailed tooltip
information about all breakpoints set on the same location. The first row gives user
breakpoint information, the following rows describe the physical breakpoints used for
implementing the user breakpoint. The latter information can also be seen in the
Breakpoint Usage dialog box.
Note: The breakpoint icons might look different for the C-SPY driver you are using.
UCS430-1
Using breakpoints
● triggering different actions: stopping the execution, or starting the state storage
module
● emulated breakpoints.
The Enhanced Emulation Module (at the required level) also gives you access to the
sequencer module which is a state machine that uses breakpoints for triggering new
states.
Hardware breakpoints
To set breakpoints, the C-SPY FET Debugger uses the hardware breakpoints available
on the device. The number of hardware breakpoints is limited, and when all hardware
breakpoints have been used C-SPY can use software breakpoints.
For information about the number of available hardware breakpoints for each device, see
the release notes or the hardware documentation.
Software breakpoints
There are two types of software breakpoints: virtual breakpoints and emulated
breakpoints. See Breakpoints, page 278, for information about how to specify which
type to use.
When virtual breakpoints are used, C-SPY is forced into single-step mode after all
hardware breakpoints have been used. However, if your device supports the Enhanced
Emulation Module at the required level, you can use emulated breakpoints for access to
an unlimited number of breakpoints.
When emulated breakpoints are used, the instruction where the breakpoint is set will be
replaced by a special instruction that the debugger recognizes. When the debugger
encounters such an instruction, it stops. This mechanism uses one hardware breakpoint
to emulate an unlimited number of breakpoints.
To prevent the debugger from executing in single-step mode if you do not use emulated
software breakpoints, you can disable the use of virtual breakpoints and—in the CLIB
runtime environment—fine-tune the use of breakpoint consumers. This will increase the
performance of the debugger, but you will only have access to the available number of
hardware breakpoints. For information about the breakpoint consumers of the debugger
system, see Breakpoint consumers, page 91.
Adding and removing software breakpoints generates many write accesses to the code
memory. This can significantly reduce the lifetime of flash memories.
BREAKPOINT CONSUMERS
Exceeding the number of available hardware breakpoints, when you do not use emulated
software breakpoints, causes the debugger to single step. This will significantly reduce
91
UCS430-1
Introduction to setting and using breakpoints
the execution speed. For this reason you must be aware of the different breakpoint
consumers.
User breakpoints
The breakpoints you define in the breakpoint dialog box or by toggling breakpoints in
the editor window often consume one physical breakpoint each, but this can vary greatly.
Some user breakpoints consume several physical breakpoints and conversely, several
user breakpoints can share one physical breakpoint. User breakpoints are displayed in
the same way both in the Breakpoint Usage dialog box and in the Breakpoints window,
for example Data @[R] callCount.
C-SPY itself
C-SPY itself also consumes breakpoints. C-SPY will set a breakpoint if:
● The debugger option Run to has been selected, and any step command is used.
These are temporary breakpoints which are only set when the debugger system is
running. This means that they are not visible in the Breakpoints window.
● The command Edit>Run to Cursor is used
● The linker option With I/O emulation modules has been selected.
These types of breakpoint consumers are displayed in the Breakpoint Usage dialog
box, for example, C-SPY Terminal I/O & libsupport module.
In the CLIB runtime environment, C-SPY will set a breakpoint if:
● the library functions putchar and getchar are used (low-level routines used by
functions like printf and scanf)
● the application has an exit label.
You can disable the setting of system breakpoints on the putchar and getchar
functions and on the exit label; see Breakpoints, page 278.
In the DLIB runtime environment, C-SPY will set a system breakpoint on the
__DebugBreak label.
When the Run to option is selected and all hardware breakpoints have already been
used, a virtual breakpoint will be set even if you have deselected the Use virtual
breakpoints option. When you start the debugger under these conditions, C-SPY will
prompt you to choose whether you want to execute in single-step mode or stop at the
first instruction.
UCS430-1
Using breakpoints
93
UCS430-1
Procedures for setting breakpoints
UCS430-1
Using breakpoints
If there are several breakpoints on the same source code line, the breakpoints will be
listed on a submenu.
2 On the context menu, choose the appropriate command.
3 In the breakpoint dialog box that appears, specify the breakpoint settings and click OK.
The breakpoint is displayed in the Breakpoints window.
95
UCS430-1
Procedures for setting breakpoints
Note: Setting breakpoints directly in the Memory window is only possible if the driver
you use supports this.
For details of each breakpoint macro, see Reference information on C-SPY system
macros, page 219.
UCS430-1
Using breakpoints
count()
{
my_counter += 1;
return 0;
}
To use this function as a condition for the breakpoint, type count() in the Expression
text box under Conditions. The task will then be performed when the breakpoint is
triggered. Because the macro function count returns 0, the condition is false and the
execution of the program will resume automatically, without any stop.
97
UCS430-1
Reference information on breakpoints
Breakpoints window
The Breakpoints window is available from the View menu.
UCS430-1
Using breakpoints
Display area
This area lists all breakpoints you define. For each breakpoint, information about the
breakpoint type, source file, source line, and source column is provided.
Context menu
This context menu is available:
99
UCS430-1
Reference information on breakpoints
New Breakpoint Displays a submenu where you can open the breakpoint
dialog box for the available breakpoint types. All
breakpoints you define using this dialog box are preserved
between debug sessions.
The Breakpoint Usage dialog box lists all breakpoints currently set in the target system,
both the ones you have defined and the ones used internally by C-SPY. The format of
the items in this dialog box depends on the C-SPY driver you are using.
The dialog box gives a low-level view of all breakpoints, related but not identical to the
list of breakpoints displayed in the Breakpoints window.
C-SPY uses breakpoints when stepping. If your target system has a limited number of
hardware breakpoints and software breakpoints are not enabled, exceeding the number
of available hardware breakpoints will cause the debugger to single step. This will
significantly reduce the execution speed. Therefore, in a debugger system with a limited
amount of hardware breakpoints, you can use the Breakpoint Usage dialog box for:
● Identifying all breakpoint consumers
● Checking that the number of active breakpoints is supported by the target system
● Configuring the debugger to use the available breakpoints in a better way, if
possible.
UCS430-1
Using breakpoints
Display area
For each breakpoint in the list, the address and access type are displayed. Each
breakpoint in the list can also be expanded to show its originator.
Break At
Specify the location of the breakpoint in the text box. Alternatively, click the Edit button
to open the Enter Location dialog box; see Enter Location dialog box, page 114.
101
UCS430-1
Reference information on breakpoints
Size
Determines whether there should be a size—in practice, a range—of locations where the
breakpoint will trigger. Each fetch access to the specified memory range will trigger the
breakpoint. Select how to specify the size:
Action
Determines whether there is an action connected to the breakpoint. Specify an
expression, for instance a C-SPY macro function, which is evaluated when the
breakpoint is triggered and the condition is true.
Conditions
Specify simple or complex conditions:
UCS430-1
Using breakpoints
Break At
Specify the location of the breakpoint. Alternatively, click the Edit button to open the
Enter Location dialog box; see Enter Location dialog box, page 114.
Message
Specify the message you want to be displayed in the C-SPY Debug Log window. The
message can either be plain text, or—if you also select the option C-SPY macro
"__message" style—a comma-separated list of arguments.
Conditions
Specify simple or complex conditions:
103
UCS430-1
Reference information on breakpoints
In the C-SPY simulator, use the Data breakpoints dialog box to set a data breakpoint.
Data breakpoints never stop execution within a single instruction. They are recorded and
reported after the instruction is executed.
Break At
Specify the location for the breakpoint in the Break At text box. Alternatively, click the
Edit button to open the Enter Location dialog box; see Enter Location dialog box, page
114.
Access Type
Selects the type of memory access that triggers data breakpoints:
UCS430-1
Using breakpoints
Size
Determines whether there should be a size—in practice, a range—of locations where the
breakpoint will trigger. Each fetch access to the specified memory range will trigger the
breakpoint. For data breakpoints, this can be useful if you want the breakpoint to be
triggered on accesses to data structures, such as arrays, structs, and unions. Select
between two different ways to specify the size:
Action
Determines whether there is an action connected to the breakpoint. Specify an
expression, for instance a C-SPY macro function, which is evaluated when the
breakpoint is triggered and the condition is true.
Conditions
Specify simple or complex conditions:
105
UCS430-1
Reference information on breakpoints
In the C-SPY simulator, use the Immediate breakpoints dialog box to set an immediate
breakpoint. Immediate breakpoints do not stop execution at all; they only suspend it
temporarily.
Break At
Specify the location for the breakpoint in the Break At text box. Alternatively, click the
Edit button to open the Enter Location dialog box; see Enter Location dialog box, page
114.
Access Type
Selects the type of memory access that triggers immediate breakpoints:
Action
Determines whether there is an action connected to the breakpoint. Specify an
expression, for instance a C-SPY macro function, which is evaluated when the
breakpoint is triggered and the condition is true.
UCS430-1
Using breakpoints
Start value
Specify the start value for the range breakpoint in the Start value text box; an
expression, an absolute address, or a source location. Alternatively, click the Edit button
to open the Enter Location dialog box; see Enter Location dialog box, page 114.
Range delimiter
Sets the end location of the range. Choose the type of delimiter and specify the value in
the text box:
End value The same type of value as for the Start value.
Length The length of the range in bytes (in hexadecimal notation).
Automatic Bases the range automatically on the type of expression the
breakpoint is set on. For example, if you set the breakpoint on a
12-byte structure, the range of the breakpoint will be 12 bytes.
107
UCS430-1
Reference information on breakpoints
Type
Selects which breakpoint type to use:
Access type
Selects the type of access that triggers the selected breakpoint:
Action
Selects the action that occurs when the breakpoint is triggered:
UCS430-1
Using breakpoints
Action when
Selects when the action shall occur:
Inside range The action occurs at an access inside the specified range.
Outside range The action occurs at an access outside of the specified range.
Break At
Specify the location for the breakpoint in the Break At text box. Alternatively, click the
Edit button to open the Enter Location dialog box; see Enter Location dialog box, page
114.
109
UCS430-1
Reference information on breakpoints
Type
Selects which breakpoint type to use:
Address bus Sets a breakpoint on the address specified in the Break At text
(MAB) box, or anything that can be evaluated to one. The breakpoint is
triggered when the specified location is accessed. If you have set
the breakpoint on a specific machine instruction, the breakpoint
will be triggered and the execution will stop exactly before the
instruction will be executed.
Data bus (MDB) Sets a breakpoint on a specified value. It is the value on the data
bus that triggers the breakpoint.
Register Sets a breakpoint on a register. Specify the register, or anything
that can be evaluated to such, in the Break At text box. In the
Register Value text box, type the value that should trigger the
breakpoint.
Operator
Selects a condition operator for when the breakpoint should be triggered:
== Equal to.
>= Greater than or equal to.
<= Less than or equal to.
!= Not equal to.
Access
Selects the type of access that triggers the selected breakpoint:
UCS430-1
Using breakpoints
Mask
Specify a bit mask value that the breakpoint address or value will be masked with. (On
the FET hardware the mask is inverted, but this is not the case in the FET Debugger
driver.)
Condition
Optionally, specify an additional condition to a conditional breakpoint. This means that
a conditional breakpoint can be a single data breakpoint or a combination of two
breakpoints that must occur at the same time. These settings can be specified for the
additional condition:
Action
Selects the action that occurs when the breakpoint is triggered:
111
UCS430-1
Reference information on breakpoints
Use the Advanced Trigger breakpoints dialog box to set an advanced trigger
breakpoint.
Advanced trigger breakpoints are available for the C-SPY FET Debugger driver on
devices that support the Enhanced Emulation Module at the required level.
Break At
Specify the location for the breakpoint in the Break At text box. Alternatively, click the
Edit button to open the Enter Location dialog box; see Enter Location dialog box, page
114.
Type
Selects which breakpoint type to use:
Address bus (MAB) Sets a breakpoint on a specified address, or anything that can be
evaluated to one. The breakpoint is triggered when the specified
location is accessed. If you have set the breakpoint on a specific
machine instruction, the breakpoint will be triggered and the
execution will stop exactly before the instruction will be
executed.
UCS430-1
Using breakpoints
Data bus (MDB) Sets a breakpoint on a specified value. It is the value on the data
bus that triggers the breakpoint.
Register Sets a breakpoint on a register. Specify the register, or anything
that can be evaluated to such, in the Break At text box. In the
Value text box, type the value that should trigger the
breakpoint.
Operator
Selects a condition operator for when the breakpoint should be triggered:
== Equal to.
>= Greater than or equal to.
<= Less than or equal to.
!= Not equal to.
Mask
Specify a bit mask value that the breakpoint address or value will be masked with. (On
the FET hardware the mask is inverted, but this is not the case in the FET Debugger
driver.)
Value
Specify the data value in the specified register that should be triggered.
Access type
Selects the type of access that triggers the selected breakpoint.
Action
Selects the action that occurs when the breakpoint is triggered:
113
UCS430-1
Reference information on breakpoints
Use the Enter Location dialog box to specify the location of the breakpoint.
Note: This dialog box looks different depending on the Type you select.
Type
Selects the type of location to be used for the breakpoint:
UCS430-1
Using breakpoints
115
UCS430-1
Reference information on breakpoints
All
The breakpoint will be set on all listed locations.
Selected
The breakpoint will be set on the source locations that you have selected in the text box.
Cancel
No location will be used.
UCS430-1
Using breakpoints
Note that this option can also be specified in the IDE Options dialog box, see Debugger
options in the IDE Project Management and Building Guide.
117
UCS430-1
Reference information on breakpoints
UCS430-1
Monitoring memory and
registers
This chapter describes how to use the features available in C-SPY® for
examining memory and registers. More specifically, this means information
about:
119
UCS430-1
Introduction to monitoring memory and registers
UCS430-1
Monitoring memory and registers
memory range. If you load a device description file, additional zones that adhere better
to the specific device memory layout are defined.
0x0000 0x0000
SFR
0x0200
RAM
0x0A00
0x1100
Flash
0xFFFFFFFF
0xFFFF 0xFFFF
Memory zones are used in several contexts, most importantly in the Memory and
Disassembly windows. Use the Zone box in these windows to choose which memory
zone to display.
Device-specific zones
Memory information for device-specific zones are defined in the device description
files. By default, there is only one zone in the debugger, Memory. If you load a device
description file, additional zones that adhere to the specific memory layout are defined.
These zones are available, depending on the device description file you are using: SFR,
RAM, INFO, and Flash.
If your hardware does not have the same memory layout as any of the predefined device
description files, you can define customized zones by adding them to the file.
For further information, see Selecting a device description file, page 37 and Modifying
a device description file, page 40.
STACK DISPLAY
The Stack window displays the contents of the stack, overflow warnings, and it has a
graphical stack bar. These can be useful in many contexts. Some examples are:
● Investigating the stack usage when assembler modules are called from C modules
and vice versa
● Investigating whether the correct elements are located on the stack
121
UCS430-1
Introduction to monitoring memory and registers
Stack usage
When your application is first loaded, and upon each reset, the memory for the stack area
is filled with the dedicated byte value 0xCD before the application starts executing.
Whenever execution stops, the stack memory is searched from the end of the stack until
a byte with a value different from 0xCD is found, which is assumed to be how far the
stack has been used. Although this is a reasonably reliable way to track stack usage,
there is no guarantee that a stack overflow is detected. For example, a stack can
incorrectly grow outside its bounds, and even modify memory outside the stack area,
without actually modifying any of the bytes near the stack range. Likewise, your
application might modify memory within the stack area by mistake.
The Stack window cannot detect a stack overflow when it happens, but can only detect
the signs it leaves behind. However, when the graphical stack bar is enabled, the
functionality needed to detect and warn about stack overflows is also enabled.
Note: The size and location of the stack is retrieved from the definition of the segment
holding the stack, made in the linker configuration file. If you, for some reason, modify
the stack initialization made in the system startup code, cstartup, you should also
change the segment definition in the linker configuration file accordingly; otherwise the
Stack window cannot track the stack usage. To read more about this, see the IAR C/C++
Compiler Reference Guide for MSP430.
UCS430-1
Monitoring memory and registers
Memory window
The Memory window is available from the View menu.
Go to location
Memory addresses
Data coverage
information
123
UCS430-1
Reference information on memory and registers
is very convenient if you want to keep track of several memory or register zones, or
monitor different parts of the memory.
To view the memory corresponding to a variable, you can select it in the editor window
and drag it to the Memory window.
Toolbar
The toolbar contains:
Display area
The display area shows the addresses currently being viewed, the memory contents in
the format you have chosen, and—provided that the display mode is set to
1x Units—the memory contents in ASCII format. You can edit the contents of the
display area, both in the hexadecimal part and the ASCII part of the area.
Data coverage is displayed with these colors:
UCS430-1
Monitoring memory and registers
Note: Data coverage is not supported by all C-SPY drivers. Data coverage is supported
by the C-SPY Simulator.
Context menu
This context menu is available:
125
UCS430-1
Reference information on memory and registers
UCS430-1
Monitoring memory and registers
Use this dialog box to save the contents of a specified memory area to a file.
Zone
Selects a memory zone.
Start address
Specify the start address of the memory range to be saved.
End address
Specify the end address of the memory range to be saved.
File format
Selects the file format to be used, which is msp430-txt by default.
Filename
Specify the destination file to be used; a browse button is available for your convenience.
Save
Saves the selected range of the memory zone to the specified file.
127
UCS430-1
Reference information on memory and registers
Use this dialog box to load the contents of a file in Intel-extended, Motorola S-record,
or msp430-txt format to a specified memory zone.
Zone
Selects a memory zone.
Filename
Specify the file to be read; a browse button is available for your convenience.
Restore
Loads the contents of the specified file to the selected memory zone.
Use this dialog box to fill a specified area of memory with a value.
UCS430-1
Monitoring memory and registers
Start address
Type the start address—in binary, octal, decimal, or hexadecimal notation.
Length
Type the length—in binary, octal, decimal, or hexadecimal notation.
Zone
Selects a memory zone.
Value
Type the 8-bit value to be used for filling each memory location.
Operation
These are the available memory fill operations:
129
UCS430-1
Reference information on memory and registers
This window displays how variables with static storage duration, typically variables
with file scope but also static variables in functions and classes, are laid out in memory.
This can be useful for better understanding memory usage or for investigating problems
caused by variables being overwritten, for example buffer overruns. Other areas of use
are spotting alignment holes or for understanding problems caused by buffers being
overwritten.
To view the memory corresponding to a variable, you can select it in the editor window
and drag it to the Symbolic Memory window.
Toolbar
The toolbar contains:
UCS430-1
Monitoring memory and registers
Display area
This area contains these columns:
There are several different ways to navigate within the memory space:
● Text that is dropped in the window is interpreted as symbols
● The scroll bar at the right-side of the window
● The toolbar buttons Next and Previous
● The toolbar list box Go to can be used for locating specific locations or symbols.
Note: Rows are marked in red when the corresponding value has changed.
Context menu
This context menu is available:
131
UCS430-1
Reference information on memory and registers
Stack window
The Stack window is available from the View menu.
Current stack
Stack view pointer Used stack memory, Unused stack memory,
in dark gray in light gray
This window is a memory window that displays the contents of the stack. In addition,
some integrity checks of the stack can be performed to detect and warn about problems
with stack overflow. For example, the Stack window is useful for determining the
optimal size of the stack.
To view the graphical stack bar:
1 Choose Tools>Options>Stack.
2 Select the option Enable graphical stack display and stack usage.
You can open several Stack windows, each showing a different stack—if several stacks
are available—or the same stack with different display settings.
Note: By default, this window uses one physical breakpoint. For more information, see
Breakpoint consumers, page 91.
For information about options specific to the Stack window, see the IDE Project
Management and Building Guide.
UCS430-1
Monitoring memory and registers
Toolbar
Display area
This area contains these columns:
133
UCS430-1
Reference information on memory and registers
Context menu
This context menu is available:
UCS430-1
Monitoring memory and registers
Register window
The Register window is available from the View menu.
This window gives an up-to-date display of the contents of the processor registers and
special function registers, and allows you to edit their contents. Optionally, you can
choose to load either predefined register groups or to define your own
application-specific groups.
You can open several instances of this window, which is very convenient if you want to
keep track of different register groups.
To enable predefined register groups:
1 Select a device description file that suits your device, see Selecting a device description
file, page 37.
2 The register groups appear in the Register window, provided that they are defined in
the device description file. Note that the available register groups are also listed on the
Register Filter page.
To define application-specific register groups, read about register filter options in the
IDE Project Management and Building Guide.
Toolbar
CPU Registers Selects which register group to display, by default CPU Registers.
Additional registers are defined in a specific register definition
file—with the filename extension sfr—which is included from
the register section of the device description file. These registers
are the device-specific memory-mapped control and status
registers for the peripheral units on the MSP430 microcontrollers.
135
UCS430-1
Reference information on memory and registers
Display area
Displays registers and their values. Every time C-SPY stops, a value that has changed
since the last stop is highlighted. To edit the contents of a register, click it, and modify
the value.
Some registers are expandable, which means that the register contains interesting bits or
subgroups of bits.
To change the display format, change the Base setting on the Register Filter
page—available by choosing Tools>Options.
Note: When the FET Debugger is used, the cycle counter registers can only be used
while single-stepping in the Disassembly window.
Register Description
CYCLECOUNTER Cycle counter, cleared at reset.
CCTIMER1, CCTIMER2 Trip counters, cleared at reset. These registers can be edited.
CCSTEP The number of cycles in the last step.
Table 9: Cycle counter registers
UCS430-1
Monitoring memory and registers
This dialog box lists all defined memory areas, where each column in the list specifies
the properties of the area. In other words, the dialog box displays the memory access
setup that will be used during the simulation.
Note: If you enable both the Use ranges based on and the Use manual ranges option,
memory accesses are checked for all defined ranges.
For information about the columns and the properties displayed, see Edit Memory
Access dialog box, page 139.
Device description file Loads properties from the device description file.
137
UCS430-1
Reference information on memory and registers
Debug file segment Properties are based on the segment information available in
information the debug file. This information is only available while
debugging. The advantage of using this option, is that the
simulator can catch memory accesses outside the linked
application.
Buttons
These buttons are available:
New Opens the Edit Memory Access dialog box, where you can
specify a new memory range and attach an access type to it; see
Edit Memory Access dialog box, page 139.
Edit Opens the Edit Memory Access dialog box, where you can edit
the selected memory area. See Edit Memory Access dialog box,
page 139.
Delete Deletes the selected memory area definition.
Delete All Deletes all defined memory area definitions.
Note: Except for the OK and Cancel buttons, buttons are only available when the
option Use manual ranges is selected.
UCS430-1
Monitoring memory and registers
Use this dialog box to specify the memory ranges, and assign an access type to each
memory range, for which you want to detect illegal accesses during the simulation.
Memory range
Defines the memory area for which you want to check the memory accesses:
Zone Selects a memory zone; see C-SPY memory zones, page 120.
Start address Specify the start address for the address range, in hexadecimal
notation.
End address Specify the end address for the address range, in hexadecimal
notation.
Access type
Selects an access type to the memory range; choose between:
● Read and write
● Read only
● Write only.
139
UCS430-1
Reference information on memory and registers
Start Address
Specify the start address for the memory section you want to save to a file.
Dump Length
Specify the length of the memory section you want to save to a file, in hexadecimal
notation. The maximum length is FFFF, which limits the number of bytes that can be
written to 65535. Consequently, you cannot write memory from address 0x0000 to
0xFFFF, inclusive, as this would require a length specifier of 65536 bytes (0x10000).
UCS430-1
Monitoring memory and registers
Format
Selects format for the text that is written to the file. Choose between:
Word
Byte
141
UCS430-1
Reference information on memory and registers
UCS430-1
Collecting and using trace
data
This chapter gives you information about collecting and using trace data in
C-SPY®. More specifically, this means:
143
UCS430-1
Procedures for using trace
UCS430-1
Collecting and using trace data
For details about these breakpoints, see Trace Start breakpoints dialog box, page 152
and Trace Stop breakpoints dialog box, page 153, respectively.
145
UCS430-1
Reference information on trace
down arrow keys, or by scrolling and clicking; the source and Disassembly windows
will be updated to show the corresponding location. This is like stepping backward and
forward through the execution history.
Double-click again to leave browse mode.
Trace window
The Trace window is available from the Simulator menu when you are using the C-SPY
simulator.
UCS430-1
Collecting and using trace data
Trace toolbar
The toolbar in the Trace window and in the Function trace window contains:
Display area
This area contains these columns:
147
UCS430-1
Reference information on trace
This window displays a subset of the trace data displayed in the Trace window. Instead
of displaying all rows, the Function Trace window only shows trace data corresponding
to calls to and returns from functions.
Toolbar
For information about the toolbar, see Trace toolbar, page 147.
Display area
For information about the columns in the display area, see:
● Display area, page 147
UCS430-1
Collecting and using trace data
Timeline window
The Timeline window is available from the Simulator menu during a debug session.
An active
interrupt
Interrupt
Log
Graph
Call
Stack
Graph
Common
time axis Selection for
current graph
This window displays trace data—for interrupt logs and for the call stack—as graphs in
relation to a common time axis.
Display area
The display area can be populated with different graphs:
● Interrupt Log Graph
● Call Stack Graph.
At the bottom of the window, there is a common time axis that uses seconds as the time
unit.
149
UCS430-1
Reference information on trace
Context menu
This context menu is available:
Note: The context menu contains some commands that are common to all graphs and
some commands that are specific to each graph.
UCS430-1
Collecting and using trace data
151
UCS430-1
Reference information on trace
UCS430-1
Collecting and using trace data
Trigger At
Specify the location for the breakpoint in the text box. Alternatively, click the Edit
browse button to open the Enter Location dialog box; see Enter Location dialog box,
page 114.
153
UCS430-1
Reference information on trace
Trigger At
Specify the location for the breakpoint in the text box. Alternatively, click the Edit
browse button to open the Enter Location dialog box; see Enter Location dialog box,
page 114.
Use this window to specify, for example, a specific variable (or an expression) for which
you want to collect trace data.
Toolbar
The toolbar buttons change the order between the expressions:
UCS430-1
Collecting and using trace data
Display area
Use the display area to specify expressions for which you want to collect trace data:
Expression Specify any expression that you want to collect data from.
You can specify any expression that can be evaluated, such
as variables and registers.
Format Shows which display format that is used for each
expression. Note that you can change display format via the
context menu.
Each row in this area will appear as an extra column in the Trace window.
Use this dialog box to specify the search criteria for advanced searches in the trace data.
The search results are displayed in the Find in Trace window—available by choosing the
View>Messages command, see Find in Trace window, page 156.
See also Searching in trace data, page 145.
155
UCS430-1
Reference information on trace
Text search
Specify the string you want to search for. To specify the search criteria, choose between:
Match Case Searches only for occurrences that exactly match the case of the
specified text. Otherwise specifying int will also find INT and
Int and so on.
Match whole word Searches only for the string when it occurs as a separate word.
Otherwise int will also find print, sprintf and so on.
Only search in one Searches only in the column you selected from the drop-down
column list.
Address Range
Specify the address range you want to display or search. The trace data within the
address range is displayed. If you also have specified a text string in the Text search
field, the text string is searched for within the address range.
This window displays the result of searches in the trace data. Double-click an item in the
Find in Trace window to bring up the same item in the Trace window.
Before you can view any trace data, you must specify the search criteria in the Find in
Trace dialog box, see Find in Trace dialog box, page 155.
See also, Searching in trace data, page 145.
UCS430-1
Collecting and using trace data
Display area
The Find in Trace window looks like the Trace window and shows the same columns
and data, but only those rows that match the specified search criteria.
157
UCS430-1
Reference information on trace
UCS430-1
Using the profiler
This chapter describes how to use the profiler in C-SPY®. More specifically,
this means:
159
UCS430-1
Procedures for using the profiler
Instruction profiling information is displayed in the Disassembly window, that is, the
number of times each instruction has been executed.
Profiling sources
The profiler can use different mechanisms, or sources, to collect profiling information.
Depending on the available hardware features, one or more of the sources can be used
for profiling:
● Trace (calls)
The full instruction trace is analyzed to determine all function calls and returns.
When the collected instruction sequence is incomplete or discontinuous, the
profiling information is less accurate.
● Trace (flat)
Each instruction in the full instruction trace is assigned to a corresponding function
or code fragment, without regard to function calls or returns. This is most useful
when the application does not exhibit normal call/return sequences, such as when
you are using an RTOS, or when you are profiling code which does not have full
debug information.
UCS430-1
Using the profiler
Category Setting
C/C++ Compiler Output>Generate debug information
Linker Output>Format>Debug information for C-SPY
Table 10: Project options for enabling the profiler
2 When you have built your application and started C-SPY, choose Simulator>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.
3 Start executing your application to collect the profiling information.
4 Profiling information is displayed in the Function Profiler window. To sort, click on the
relevant column header.
5 When you start a new sampling, you can click the Clear button—alternatively, use the
context menu—to clear the data.
161
UCS430-1
Reference information on the profiler
5 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.
For each instruction, the number of times it has been executed is displayed.
UCS430-1
Using the profiler
Toolbar
The toolbar contains:
163
UCS430-1
Reference information on the profiler
Display area
The content in the display area depends on which source that is used for the profiling
information:
● For the Trace (calls) source, the display area contains one line for each function
compiled with debug information enabled. 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.
● For the Trace (flat) source, the display area contains one line for each C function of
your application, but also lines for sections of code from the runtime library or from
other code without debug information, denoted only by the corresponding
assembler labels. Each executed PC address from trace data is treated as a separate
sample and is associated with the corresponding line in the Profiling window. Each
line contains a count of those samples.
More specifically, the display area provides information in these columns:
UCS430-1
Using the profiler
Context menu
This context menu is available:
165
UCS430-1
Reference information on the profiler
UCS430-1
Code coverage
This chapter describes the code coverage functionality in C-SPY®, which helps
you verify whether all parts of your code have been executed. More
specifically, this means:
167
UCS430-1
Reference information on code coverage
This window reports the status of the current code coverage analysis. For every program,
module, and function, the analysis shows the percentage of code that has been executed
since code coverage was turned on up to the point where the application has stopped. In
addition, all statements that have not been executed are listed. The analysis will continue
until turned off.
An asterisk (*) in the title bar indicates that C-SPY has continued to execute, and that
the Code Coverage window must be refreshed because the displayed information is no
longer up to date. To update the information, use the Refresh command.
To get started using code coverage:
1 Before using the code coverage functionality you must build your application using
these options:
Category Setting
C/C++ Compiler Output>Generate debug information
Linker Format>Debug information for C-SPY
Table 11: Project options for enabling code coverage
UCS430-1
Code coverage
Category Setting
Debugger Plugins>Code Coverage
Table 11: Project options for enabling code coverage
2 After you have built your application and started C-SPY, choose View>Code
Coverage to open the Code Coverage window.
3 Click the Activate button, alternatively choose Activate from the context menu, to
switch on code coverage.
4 Start the execution. When the execution stops, for instance because the program exit is
reached or a breakpoint is triggered, click the Refresh button to view the code
coverage information.
Display area
The code coverage information is displayed in a tree structure, showing the program,
module, function, and statement levels. The window displays only source code that was
compiled with debug information. Thus, startup code, exit code, and library code is not
displayed in the window. Furthermore, coverage information for statements in inlined
functions is not displayed. Only the statement containing the inlined function call is
marked as executed. The plus sign and minus sign icons allow you to expand and
collapse the structure.
These icons give you an overview of the current status on all levels:
The percentage displayed at the end of every program, module, and function line shows
the amount of statements that has been covered so far, that is, the number of executed
statements divided with the total number of statements.
For statements that have not been executed (yellow diamond), the information displayed
is the column number range and the row number of the statement in the source window,
followed by the address of the step point:
<column_start>-<column_end>:row address.
169
UCS430-1
Reference information on code coverage
A statement is considered to be executed when one of its instructions has been executed.
When a statement has been executed, it is removed from the window and the percentage
is increased correspondingly.
Double-clicking a statement or a function in the Code Coverage window displays that
statement or function as the current position in the source window, which becomes the
active window. Double-clicking a module on the program level expands or collapses the
tree structure.
Context menu
This context menu is available:
UCS430-1
Using state storage
This chapter describes how to use the state storage module. More specifically,
this means:
171
UCS430-1
Procedures for using state storage
REQUIREMENTS
The state storage module is only available if you are using the C-SPY FET Debugger
driver and a device that supports the Enhanced Emulation Module at the required level.
UCS430-1
Using state storage
Example
As an example, assume the following setup:
● There is a conditional breakpoint which has both of the action options
selected—Break and State Storage Trigger
● The state storage options Instruction fetch and Buffer wrap around are selected
in the State Storage Control window.
This will start the state storage immediately when you start executing your application.
When the breakpoint is triggered, the execution will stop and the last eight states can be
inspected in the State Storage window.
However, if you do not want the state storage module to start until a specific state is
reached, you would usually not want the execution to stop, because no state information
has been stored yet.
In this case, select the State Storage Trigger action in the Conditional breakpoints
dialog box (making sure that Break is deselected), and deselect the option Buffer wrap
around in the State Storage Control window.
When the breakpoint is triggered, the execution will not stop, but the state storage will
start. Because the option Buffer wrap around is deselected, you have ensured that the
data in the buffer will not be overwritten.
When another breakpoint (which has Break selected) is triggered, or if you stop the
execution by clicking the Break button, the State Storage window will show eight states
starting with the breakpoint that was used for starting the state storage module.
173
UCS430-1
Reference information on state storage
Use this window to define how to use the state storage module. The window is only
available for devices that support the Enhanced Emulation Module at the required level.
Reset
Resets the state storage module.
Trigger action
Selects which action to take when breakpoints defined as state storage triggers are
triggered:
UCS430-1
Using state storage
Stop on trigger Starts state storage immediately when execution starts. State
storage stops when the breakpoint is triggered.
None Starts state storage immediately when execution starts. State
storage does not stop when the breakpoint is triggered.
However, if execution stops, state storage also stops but it will
resume when execution resumes.
Storage action on
Selects when the state information should be collected:
Triggers Stores state information at the time when the state storage
trigger is triggered. That is, when the breakpoint defined as a
state storage trigger is triggered.
Instruction fetch Stores state information at all instruction fetches.
All cycles Stores state information for all cycles.
This window displays state storage information for eight states. Invalid data is displayed
in red color.
175
UCS430-1
Reference information on state storage
Toolbar
The toolbar contains:
Display area
This area contains these columns:
UCS430-1
Using the sequencer
This chapter describes the sequencer and how to take advantage of it. More
specifically, this means:
177
UCS430-1
Procedures for using the sequencer
breakpoint can be designed either to stop execution, or to trigger the state storage
module.
UCS430-1
Using the sequencer
From the eight available hardware breakpoints (0-7) of the device, breakpoint number 7
will be reserved for state 3. The Transition trigger drop-down lists let you define one
breakpoint each, where the breakpoint should act as a transition trigger.
4 For each transition trigger, define which state should be the next state after the
transition.
Use the following options:
State Storage Trigger Select a breakpoint from the drop-down list to move the state
machine from one state to another. Note: to do this you must
first define the required conditional breakpoints.
Next state Select a state to define which state should be the next state after
the transition.
5 Select an action to determine the result of the final transition trigger. If you select the
option Break, the execution will stop. If you select the option State Storage Trigger,
the state storage module will be triggered.
void my_function(void)
{
...
my_putchar('a');
...
my_putchar('x');
...
my_putchar('@');
...
}
In this example, the customized putchar function my_putchar has for some reason a
problem with special characters. To locate the problem, it might be useful to stop
execution when the function is called, but only when it is called with one of the
problematic characters as the argument.
179
UCS430-1
Procedures for using the sequencer
Option Setting
Transition trigger 0 The breakpoint which is set on the function call
my_putchar('@');
Transition trigger 1 The breakpoint which is set on the suspected code within the function
my_putchar()
Action Break
Table 12: Sequencer settings - example
The transition trigger 1 depends on the transition trigger 0. This means that the execution
will stop only when the function my_putchar() is called by the function call
my_putchar('@');
Click OK.
5 Set up the state storage module. Choose Emulator>State Storage Control to open the
State Storage Control window. Make sure the following options are selected:
Option Setting
Enable state storage Selected
Buffer wrap around Selected
Storage action Instruction fetch
Trigger action None
Table 13: State Storage Control settings—example
Click OK.
6 Start the program execution. The state storage module will continuously store trace
information. Execution stops when the function my_putchar() has been called by the
function call my_putchar('@');
7 Choose Emulator>State Storage Window to open the State Storage window. You
can now examine the stored trace information. For more information, see State Storage
window, page 175.
UCS430-1
Using the sequencer
Use this window to break the execution or trigger the state storage module, using a more
complex method than a standard breakpoint. The window is only available for devices
that support the Enhanced Emulation Module at the required level.
For related information about state storage, see Using state storage, page 171.
Enable Sequencer
Enables the sequencer.
181
UCS430-1
Reference information on the sequencer
Action
Controls the result of the final transition trigger:
Current state
Displays the current state of the state machine.
Reset Trigger
Selects a trigger that will reset the state machine.
Reset States
Sets the state machine to state 0.
Advanced
Displays the advanced setup options. This will let you define 4 states (numbered 0–3)
with two transition triggers each (a and b). For each transition trigger, you can define
which state should be the next state after the transition.
State 0–3
Controls the transition triggers and the state that follows the transitions.
For state 3—the final transition trigger—you must also define an Action: Break or
State Storage Trigger.
UCS430-1
Using the cycle counter for
5xx devices
This chapter describes the cycle counter for MSP430F5xx devices. More
specifically, this means:
183
UCS430-1
Procedures for using the cycle counter applications
UCS430-1
Using the cycle counter for 5xx devices
185
UCS430-1
Procedures for using the cycle counter applications
UCS430-1
Using the cycle counter for 5xx devices
3 Choose Emulator>Cycle Counter for 5xx to open the Cycle Counter 5xx Control
window.
4 Select the Trip counter option.
5 Select the start trigger point from the drop-down list Reaction trigger 1.
6 Select the stop trigger point from the drop-down list Reaction trigger 2.
7 Click the Reset Counter 1 button to reset Cycle counter 1.
8 Execute your program. The execution stops when the stop trigger is reached.
In the Cycle Counter Values area, Cycle counter 1 now shows the number of CPU
cycles required to execute the task or function.
Use this window to set the behavior of Cycle counter 1, the extra cycle counter for
MSP430F5xx devices.
187
UCS430-1
Reference information on the cycle counter for 5xx
Applications
The Cycle Counter 5xx Control window contains preconfigured applications, as well as
the opportunity to customize your own use of the cycle counter. Use the cycle counter
Applications to configure for what purpose to use the cycle counter. Choose between:
Cycle counter Makes Cycle counter 1 count all CPU cycles; see Counting all
CPU cycles, page 184.
DMA load vs. CPU Compares the number of DMA bus cycles with the total number
load of bus cycles; see Measuring the DMA load versus the CPU load,
page 185.
Profiling Profiles a specific part of your program; see Profiling a specific
part of your application, page 185.
Trigger hits Measures the number of times a certain point in your program
has been reached; see Measuring the Trigger hits, page 186.
Trip counter Measures the number of CPU cycles required to execute a certain
task or function; see Measuring the number of CPU cycles for a
task, page 186.
Custom Make a custom application using the options in the Cycle
Counter 1 area.
Cycle counter 0 The value of cycle counter 0. Cycle counter 0 is the same cycle
counter as the one displayed in the Register window.
Cycle counter 1 The value of Cycle counter 1. Cycle counter 1 is controlled by the
settings in the Cycle Counter 5xx Control window.
Mode
UCS430-1
Using the cycle counter for 5xx devices
Start
Reaction Uses the cycle counter reaction to start the cycle counter.
CPU starts Starts counting cycles when the CPU starts to execute.
Stop
Reaction Uses the cycle counter reaction to stop the cycle counter.
CPU stops Stops counting when the CPU stops the execution.
Clear
Reset Counter 1
Resets the value and state of Cycle counter 1.
189
UCS430-1
Reference information on the cycle counter for 5xx
UCS430-1
Simulating interrupts
By simulating interrupts, you can debug the program logic long before any
hardware is available. This chapter contains detailed information about the
C-SPY® interrupt simulation system and how to configure the simulated
interrupts to make them reflect the interrupts of your target hardware. More
specifically, this means:
191
UCS430-1
Introduction to interrupt simulation
UCS430-1
Simulating interrupts
INTERRUPT CHARACTERISTICS
The simulated interrupts consist of a set of characteristics which lets you fine-tune each
interrupt to make it resemble the real interrupt on your target hardware. You can specify
a first activation time, a repeat interval, a hold time, a variance, and a probability.
The interrupt simulation system uses the cycle counter as a clock to determine when an
interrupt should be raised in the simulator. You specify the first activation time, which
is based on the cycle counter. C-SPY will generate an interrupt when the cycle counter
has passed the specified activation time. However, interrupts can only be raised between
instructions, which means that a full assembler instruction must have been executed
before the interrupt is generated, regardless of how many cycles an instruction takes.
To define the periodicity of the interrupt generation you can specify the repeat interval
which defines the amount of cycles after which a new interrupt should be generated. In
addition to the repeat interval, the periodicity depends on the two options
probability—the probability, in percent, that the interrupt will actually appear in a
period—and variance—a time variation range as a percentage of the repeat interval.
These options make it possible to randomize the interrupt simulation. You can also
specify a hold time which describes how long the interrupt remains pending until
removed if it has not been processed. If the hold time is set to infinite, the corresponding
pending bit will be set until the interrupt is acknowledged or removed.
193
UCS430-1
Introduction to interrupt simulation
For a repeatable interrupt that has a specified repeat interval which is longer than the
execution time, the status information at different times can look like this:
Note: The interrupt activation signal—also known as the pending bit—is automatically
deactivated the moment the interrupt is acknowledged by the interrupt handler.
If the interrupt repeat interval is shorter than the execution time, and the interrupt is
reentrant (or non-maskable), the status information at different times can look like this:
UCS430-1
Simulating interrupts
In this case, the execution time of the interrupt handler is too long compared to the repeat
interval, which might indicate that you should rewrite your interrupt handler and make
it faster, or that you should specify a longer repeat interval for the interrupt simulation
system.
The parameters of the first five macros correspond to the equivalent entries of the
Interrupts dialog box.
For detailed reference information about each macro, see Reference information on
C-SPY system macros, page 219.
195
UCS430-1
Procedures for simulating interrupts
UCS430-1
Simulating interrupts
2 Add your interrupt service routine to your application source code and add the file to
your project.
3 Choose Project>Options>Debugger>Setup and select a device description file. The
device description file contains information about the interrupt that C-SPY needs to be
able to simulate it. Use the Use device description file browse button to locate the ddf
file.
4 Build your project and start the simulator.
5 Choose Simulator>Interrupt Setup to open the Interrupts Setup dialog box. Select
the Enable interrupt simulation option to enable interrupt simulation. Click New to
open the Edit Interrupt dialog box. For the Timer example, verify these settings:
Option Settings
Interrupt BASICTIMER_VECTOR
First activation 4000
Repeat interval 2000
Hold time 10
Probability (%) 100
Variance (%) 0
Table 15: Timer interrupt settings
Click OK.
6 Execute your application. If you have enabled the interrupt properly in your application
source code, C-SPY will:
● Generate an interrupt when the cycle counter has passed 4000
● Continuously repeat the interrupt after approximately 2000 cycles.
7 To watch the interrupt in action, choose Simulator>Interrupt Log to open the
Interrupt Log window.
197
UCS430-1
Reference information on simulating interrupts
executing. The interrupt simulation system will work correctly, but the status
information in the Interrupt Setup dialog box might not look as you expect. If too
many interrupts are executing simultaneously, a warning might be issued.
To simulate a normal interrupt exit:
1 Set a code breakpoint on the instruction that returns from the interrupt function.
2 Specify the __popSimulatorInterruptExecutingStack macro as a condition to
the breakpoint.
When the breakpoint is triggered, the macro is executed and then the application
continues to execute automatically.
This dialog box lists all defined interrupts. Use this dialog box to enable or disable the
interrupt simulation system, as well as to enable or disable individual interrupts.
UCS430-1
Simulating interrupts
Display area
This area contains these columns:
Interrupt Lists all interrupts. Use the checkbox to enable or disable the
interrupt.
Type Shows the type of the interrupt. The type can be one of:
Forced, a single-occasion interrupt defined in the Forced
Interrupt Window.
Single, a single-occasion interrupt.
Repeat, a periodically occurring interrupt.
For repeatable interrupts there might be additional information
about how many interrupts of the same type that are
simultaneously executing (n executing). If n is larger than one,
there is a reentrant interrupt in your interrupt simulation system
that never finishes executing, which might indicate that there is a
problem in your application.
Status Shows the state of the interrupt:
Idle, the interrupt activation signal is low (deactivated).
Pending, the interrupt activation signal is active, but the interrupt
has not been acknowledged yet by the interrupt handler.
Executing, the interrupt is currently being serviced, that is the
interrupt handler function is executing.
Executed, this is a single-occasion interrupt and it has been
serviced.
Removed, the interrupt has been removed, but because the
interrupt is currently executing it is visible until it is finished.
Rejected, the interrupt has been rejected because the necessary
interrupt registers are not set up to accept the interrupt.
Expired, this is a single-occasion interrupt which was not
serviced while the interrupt activation signal was active.
Next Activation Shows the next activation time in cycles.
199
UCS430-1
Reference information on simulating interrupts
Buttons
These buttons are available:
New Opens the Edit Interrupt dialog box, see Edit Interrupt dialog
box, page 200.
Edit Opens the Edit Interrupt dialog box, see Edit Interrupt dialog
box, page 200.
Delete Removes the selected interrupt.
Delete All Removes all interrupts.
Use this dialog box to interactively fine-tune the interrupt parameters. You can add the
parameters and quickly test that the interrupt is generated according to your needs.
Interrupt
Selects the interrupt that you want to edit. The drop-down list contains all available
interrupts. Your selection will automatically update the Description box. The list is
populated with entries from the device description file that you have selected.
UCS430-1
Simulating interrupts
Description
A description of the selected interrupt, if available. The description is retrieved from the
selected device description file and consists of a string describing the vector address,
priority, enable bit, and pending bit, separated by space characters. For interrupts
specified using the system macro __orderInterrupt, the Description box is empty.
First activation
Specify the value of the cycle counter after which the specified type of interrupt will be
generated.
Repeat interval
Specify the periodicity of the interrupt in cycles.
Variance %
Selects a timing variation range, as a percentage of the repeat interval, in which the
interrupt might occur for a period. For example, if the repeat interval is 100 and the
variance 5%, the interrupt might occur anywhere between T=95 and T=105, to simulate
a variation in the timing.
Hold time
Specify how long, in cycles, the interrupt remains pending until removed if it has not
been processed. If you select Infinite, the corresponding pending bit will be set until the
interrupt is acknowledged or removed.
Probability %
Selects the probability, in percent, that the interrupt will actually occur within the
specified period.
201
UCS430-1
Reference information on simulating interrupts
Use this window to force an interrupt instantly. This is useful when you want to check
your interrupt logistics and interrupt routines.
The hold time for a forced interrupt is infinite, and the interrupt exists until it has been
serviced or until a reset of the debug session.
To force an interrupt:
1 Enable the interrupt simulation system, see Interrupt Setup dialog box, page 198.
2 Double-click the interrupt in the Forced Interrupt window, or select the interrupt and
click Trigger.
Display area
Lists all available interrupts and their definitions. The description field is editable and
the information is retrieved from the selected device description file. See this file for a
detailed description.
Trigger
Triggers the interrupt you selected in the display area.
UCS430-1
Simulating interrupts
This window displays runtime information about the interrupts that you have activated
in the Edit Interrupts dialog box or forced via the Forced Interrupt window. The
information is useful for debugging the interrupt handling in the target system.
When the Interrupt Log window is open it is updated continuously during runtime.
Note: If the window becomes full of entries, the first entries are erased.
Display area
This area contains these columns:
Cycles The point in time, measured in cycles, when the event occurred.
Displayed if Show Cycles is selected on the context menu.
Time The point in time, measured in seconds, when the event occurred.
Displayed if Show Time is selected on the context menu.
Interrupt The interrupt as defined in the device description file.
Status Shows the event status of the interrupt:
Triggered, the interrupt has passed its activation time.
Forced, the same as Triggered, but the interrupt has been forced
from the Forced Interrupt window.
Executing, the interrupt is currently executing.
Finished, the interrupt has been executed.
Expired, the interrupt hold time has expired without the interrupt
being executed.
Rejected, the interrupt has been rejected because the necessary
interrupt registers are not set up to accept the interrupt.
203
UCS430-1
Reference information on simulating interrupts
Program Counter The value of the program counter when the event occurred.
Execution Cycles The duration of the interrupt in execution cycles. Displayed if
Show Cycles is selected on the context menu.
Execution Time The duration of the interrupt in [Link] if Show Time
is selected on the context menu.
Context menu
This context menu is available:
Related information
For related information, see Timeline window, page 149.
UCS430-1
Using C-SPY macros
C-SPY® includes a comprehensive macro language which allows you to
automate the debugging process and to simulate peripheral devices.
This chapter describes the C-SPY macro language, its features, for what
purpose these features can be used, and how to use them. More specifically,
this means:
205
UCS430-1
Introduction to C-SPY macros
● Simulating peripheral devices, see the chapter Simulating interrupts. This only
applies if you are using the simulator driver.
● Developing small debug utility functions, for instance calculating the stack depth.
UCS430-1
Using C-SPY macros
Example
Consider this example of a macro function which illustrates the various components of
the macro language:
__var oldVal;
CheckLatest(val)
{
if (oldval != val)
{
__message "Message: Changed from ", oldval, " to ", val, "\n";
oldval = val;
}
}
Note: Reserved macro words begin with double underscores to prevent name conflicts.
207
UCS430-1
Procedures for using C-SPY macros
UCS430-1
Using C-SPY macros
Use this dialog box to list, register, and edit your macro files and functions. The dialog
box offers you an interactive interface for registering your macro functions which is
convenient when you develop macro functions and continuously want to load and test
them.
Macro functions that have been registered using the dialog box are deactivated when you
exit the debug session, and will not automatically be registered at the next debug session.
To register a macro file:
1 Select the macro files you want to register in the file selection list, and click Add or
Add All to add them to the Selected Macro Files list. Conversely, you can remove
files from the Selected Macro Files list using Remove or Remove All.
209
UCS430-1
Procedures for using C-SPY macros
2 Click Register to register the macro functions, replacing any previously defined macro
functions or variables. Registered macro functions are displayed in the scroll list under
Registered Macros.
Note: System macros cannot be removed from the list, they are always registered.
To list macro functions:
1 Select All to display all macro functions, select User to display all user-defined
macros, or select System to display all system macros.
2 Click either Name or File under Registered Macros to display the column contents
sorted by macro names or by file. Clicking a second time sorts the contents in the
reverse order.
To modify a macro file:
Double-click a user-defined macro function in the Name column to open the file where
the function is defined, allowing you to modify it.
This macro function registers the additional macro files [Link] and
[Link]. Because the macro function is defined with the function
name execUserSetup, it will be executed directly after your application has been
downloaded.
2 Save the file using the filename extension mac.
UCS430-1
Using C-SPY macros
Alternatively, in the macro file editor window, select the macro function name
WDTstatus(). Right-click, and choose Quick Watch from the context menu that
appears.
211
UCS430-1
Procedures for using C-SPY macros
UCS430-1
Using C-SPY macros
Note that the expression in the Action field is evaluated only when the breakpoint causes
the execution to really stop. If you want to log a value and then automatically continue
execution, you can either:
● Use a Log breakpoint, see Log breakpoints dialog box, page 103
● Use the Condition field instead of the Action field. For an example, see Performing
a task and continue execution, page 97.
7 You can easily enhance the log macro function by, for instance, using the __fmessage
statement instead, which will print the log information to a file. For information about
the __fmessage statement, see Formatted output, page 216.
For a complete example where a serial port input buffer is simulated using the method
of connecting a macro to a breakpoint, see the tutorial Simulating an interrupt in the
Information Center.
MACRO FUNCTIONS
C-SPY macro functions consist of C-SPY variable definitions and macro statements
which are executed when the macro is called. An unlimited number of parameters can
be passed to a macro function, and macro functions can return a value on exit.
A C-SPY macro has this form:
macroName (parameterList)
{
macroBody
}
Type checking is neither performed on the values passed to the macro functions nor on
the return value.
213
UCS430-1
Reference information on the macro language
MACRO VARIABLES
A macro variable is a variable defined and allocated outside your application. It can then
be used in a C-SPY expression, or you can assign application data—values of the
variables in your application—to it. For detailed information about C-SPY expressions,
see C-SPY expressions, page 72.
The syntax for defining one or more macro variables is:
__var nameList;
In case of a name conflict between a C symbol and a C-SPY macro variable, C-SPY
macro variables have a higher precedence than C variables. Note that macro variables
are allocated on the debugger host and do not affect your application.
MACRO STRINGS
In addition to C types, macro variables can hold values of macro strings. Note that
macro strings differ from C language strings.
When you write a string literal, such as "Hello!", in a C-SPY expression, the value is
a macro string. It is not a C-style character pointer char*, because char* must point to
a sequence of characters in target memory and C-SPY cannot expect any string literal to
actually exist in target memory.
You can manipulate a macro string using a few built-in macro functions, for example
__strFind or __subString. The result can be a new macro string. You can
concatenate macro strings using the + operator, for example str + "tail". You can
also access individual characters using subscription, for example str[3]. You can get
the length of a string using sizeof(str). Note that a macro string is not
NULL-terminated.
UCS430-1
Using C-SPY macros
MACRO STATEMENTS
Statements are expected to behave in the same way as the corresponding C statements
would do. The following C-SPY macro statements are accepted:
Expressions
expression;
For detailed information about C-SPY expressions, see C-SPY expressions, page 72.
Conditional statements
if (expression)
statement
if (expression)
statement
else
statement
Loop statements
for (init_expression; cond_expression; update_expression)
statement
while (expression)
statement
215
UCS430-1
Reference information on the macro language
do
statement
while (expression);
Return statements
return;
return expression;
If the return value is not explicitly set, signed int 0 is returned by default.
Blocks
Statements can be grouped in blocks.
{
statement1
statement2
.
.
.
statementN
}
FORMATTED OUTPUT
C-SPY provides various methods for producing formatted output:
UCS430-1
Using C-SPY macros
To produce strings:
myMacroVar = __smessage 42, " is the answer.";
These match the formats available in the Watch and Locals windows, but number
prefixes and quotes around strings and characters are not printed. Another example:
__message "The character '", cvar:%c, "' has the decimal value
", cvar;
would produce:
65 is the numeric value of the character A
Note: The default format for certain types is primarily designed to be useful in the
Watch window and other related windows. For example, a value of type char is
formatted as 'A' (0x41), while a pointer to a character (potentially a C string) is
formatted as 0x8102 "Hello", where the string part shows the beginning of the string
(currently up to 60 characters).
217
UCS430-1
Reference information on reserved setup macro function names
When printing a value of type char*, use the %x format specifier to print just the pointer
value in hexadecimal notation, or use the system macro __toString to get the full
string value.
If you define interrupts or breakpoints in a macro file that is executed at system start
(using execUserSetup) we strongly recommend that you also make sure that they are
removed at system shutdown (using execUserExit). An example is available in
[Link], see Simulating an interrupt in the Information Center.
The reason for this is that the simulator saves interrupt settings between sessions and if
they are not removed they will get duplicated every time execUserSetup is executed
again. This seriously affects the execution speed.
UCS430-1
Using C-SPY macros
219
UCS430-1
Reference information on C-SPY system macros
Macro Description
__setAdvancedTriggerBreak Sets an advanced trigger breakpoint
__setCodeBreak Sets a code breakpoint
__setConditionalBreak Sets a conditional breakpoint
__setDataBreak Sets a data breakpoint
__setLogBreak Sets a log breakpoint
__setRangeBreak Sets a range breakpoint
__setSimBreak Sets a simulation breakpoint
__setTraceStartBreak Sets a trace start breakpoint
__setTraceStopBreak Sets a trace stop breakpoint
__sourcePosition Returns the file name and source location if the
current execution location corresponds to a source
location
__strFind Searches a given string for the occurrence of
another string
__subString Extracts a substring from another string
__targetDebuggerVersion Returns the version of the target debugger
__toLower Returns a copy of the parameter string where all the
characters have been converted to lower case
__toString Prints strings
__toUpper Returns a copy of the parameter string where all the
characters have been converted to upper case
__unloadImage Unloads a debug image.
__writeFile Writes to the specified file
__writeFileByte Writes one byte to the specified file
__writeMemory8, Writes one byte to the specified memory location
__writeMemoryByte
__writeMemory16 Writes a two-byte word to the specified memory
location
__writeMemory32 Writes a four-byte word to the specified memory
location
Table 18: Summary of system macros (Continued)
UCS430-1
Using C-SPY macros
__cancelAllInterrupts
Syntax __cancelAllInterrupts()
__cancelInterrupt
Syntax __cancelInterrupt(interrupt_id)
Parameter
interrupt_id The value returned by the corresponding
__orderInterrupt macro call (unsigned long)
Return value
Result Value
Successful int 0
Unsuccessful Non-zero error number
Table 19: __cancelInterrupt return values
__clearBreak
Syntax __clearBreak(break_id)
Parameter
break_id The value returned by any of the set breakpoint macros
221
UCS430-1
Reference information on C-SPY system macros
__closeFile
Syntax __closeFile(fileHandle)
Parameter
fileHandle The macro variable used as filehandle by the __openFile
macro
__delay
Syntax __delay(value)
Parameter
value The number of milliseconds to delay execution
__disableInterrupts
Syntax __disableInterrupts()
Return value
Result Value
Successful int 0
Unsuccessful Non-zero error number
Table 20: __disableInterrupts return values
UCS430-1
Using C-SPY macros
__driverType
Syntax __driverType(driver_id)
Parameter
driver_id A string corresponding to the driver you want to check for.
Choose one of these:
"sim" corresponds to the simulator driver.
"fet" corresponds to the FET debugger driver.
Return value
Result Value
Successful 1
Unsuccessful 0
Table 21: __driverType return values
Description Checks to see if the current C-SPY driver is identical to the driver type of the
driver_id parameter.
Example __driverType("sim")
If the simulator is the current driver, the value 1 is returned. Otherwise 0 is returned.
__enableInterrupts
Syntax __enableInterrupts()
Return value
Result Value
Successful int 0
Unsuccessful Non-zero error number
Table 22: __enableInterrupts return values
223
UCS430-1
Reference information on C-SPY system macros
__evaluate
Syntax __evaluate(string, valuePtr)
Parameter
string Expression string
valuePtr Pointer to a macro variable storing the result
Return value
Result Value
Successful int 0
Unsuccessful int 1
Table 23: __evaluate return values
Description This macro interprets the input string as an expression and evaluates it. The result is
stored in a variable pointed to by valuePtr.
Example This example assumes that the variable i is defined and has the value 5:
__evaluate("i + 3", &myVar)
__isBatchMode
Syntax __isBatchMode()
Return value
Result Value
True int 1
False int 0
Table 24: __isBatchMode return values
Description This macro returns True if the debugger is running in batch mode, otherwise it returns
False.
UCS430-1
Using C-SPY macros
__loadImage
Syntax __loadImage(path, offset, debugInfoOnly)
Parameter
path A string that identifies the path to the image to download. The
path must either be absolute or use argument variables. Read
more about argument variables in the IDE Project
Management and Building Guide.
offset An integer that identifies the offset to the destination address
for the downloaded image.
debugInfoOnly A non-zero integer value if no code or data should be
downloaded to the target system, which means that C-SPY
will only read the debug information from the debug file. Or,
0 (zero) for download.
Return value
Value Result
Non-zero integer number A unique module identification.
int 0 Loading failed.
Table 25: __loadImage return values
Example 1 Your system consists of a ROM library and an application. The application is your active
project, but you have a debug file corresponding to the library. In this case you can add
this macro call in the execUserSetup macro in a C-SPY macro file, which you
associate with your project:
__loadImage(ROMfile, 0x8000, 1);
This macro call loads the debug information for the ROM library ROMfile without
downloading its contents (because it is presumably already in ROM). Then you can
debug your application together with the library.
Example 2 Your system consists of a ROM library and an application, but your main concern is the
library. The library needs to be programmed into flash memory before a debug session.
While you are developing the library, the library project must be the active project in the
IDE. In this case you can add this macro call in the execUserSetup macro in a C-SPY
macro file, which you associate with your project:
__loadImage(ApplicationFile, 0x8000, 0);
225
UCS430-1
Reference information on C-SPY system macros
The macro call loads the debug information for the application and downloads its
contents (presumably into RAM). Then you can debug your library together with the
application.
See also Images, page 272 and Loading multiple images, page 39.
__memoryRestore
Syntax __memoryRestore(zone, filename)
Parameters
zone The memory zone name (string); for a list of available zones, see C-SPY
memory zones, page 120.
filename A string that specifies the file to be read. The filename must include a
path, which must either be absolute or use argument variables. For
information about argument variables, see the IDE Project Management
and Building Guide.
Description Reads the contents of a file and saves it to the specified memory zone.
__memorySave
Syntax __memorySave(start, stop, format, file)
Parameters
start A string that specifies the first location of the memory area to be saved
stop A string that specifies the last location of the memory area to be saved
UCS430-1
Using C-SPY macros
format A string that specifies the format to be used for the saved memory.
Choose between:
intel-extended
motorola
motorola-s19
motorola-s28
motorola-s37
msp430-txt.
filename A string that specifies the file to write to. The filename must include a
path, which must either be absolute or use argument variables. For
information about Argument variables, see the IDE Project Management
and Building Guide.
__openFile
Syntax __openFile(filename, access)
Parameters
filename The file to be opened. The filename must include a path, which must
either be absolute or use argument variables. For information about
argument variables, see the IDE Project Management and Building
Guide.
227
UCS430-1
Reference information on C-SPY system macros
Return value
Result Value
Successful The file handle
Unsuccessful An invalid file handle, which tests as False
Table 26: __openFile return values
Description Opens a file for I/O operations. The default base directory of this macro is where the
currently open project file (*.ewp) is located. The argument to __openFile can
specify a location relative to this directory. In addition, you can use argument variables
such as $PROJ_DIR$ and $TOOLKIT_DIR$ in the path argument.
See also For information about argument variables, see the IDE Project Management and
Building Guide.
UCS430-1
Using C-SPY macros
__orderInterrupt
Syntax __orderInterrupt(specification, first_activation,
repeat_interval, variance, infinite_hold_time,
hold_time, probability)
Parameters
specification The interrupt (string). The specification can either be the full
specification used in the device description file (ddf) or only
the name. In the latter case the interrupt system will
automatically get the description from the device description
file.
first_activation The first activation time in cycles (integer)
repeat_interval The periodicity in cycles (integer)
variance The timing variation range in percent (integer between 0
and 100)
infinite_hold_time 1 if infinite, otherwise 0.
Example This example generates a repeating interrupt using an infinite hold time first activated
after 4000 cycles:
__orderInterrupt( "USART0RX_VECTOR", 4000, 2000, 0, 1, 0, 100 );
__popSimulatorInterruptExecutingStack
Syntax __popSimulatorInterruptExecutingStack(void)
229
UCS430-1
Reference information on C-SPY system macros
Description Informs the interrupt simulation system that an interrupt handler has finished executing,
as if the normal instruction used for returning from an interrupt handler was executed.
This is useful if you are using interrupts in such a way that the normal instruction for
returning from an interrupt handler is not used, for example in an operating system with
task-switching. In this case, the interrupt simulation system cannot automatically detect
that the interrupt has finished executing.
__readFile
Syntax __readFile(fileHandle, valuePtr)
Parameters
fileHandle A macro variable used as filehandle by the __openFile
macro
valuePtr A pointer to a variable
Return value
Result Value
Successful 0
Unsuccessful Non-zero error number
Table 27: __readFile return values
Description Reads a sequence of hexadecimal digits from the given file and converts them to an
unsigned long which is assigned to the value parameter, which should be a pointer
to a macro variable.
UCS430-1
Using C-SPY macros
__readFileByte
Syntax __readFileByte(fileHandle)
Parameter
fileHandle A macro variable used as filehandle by the __openFile
macro
Return value -1 upon error or end-of-file, otherwise a value between 0 and 255.
__readMemory8, __readMemoryByte
Syntax __readMemory8(address, zone)
__readMemoryByte(address, zone)
Parameters
address The memory address (integer)
zone The memory zone name (string); for a list of available
zones, see C-SPY memory zones, page 120.
__readMemory16
Syntax __readMemory16(address, zone)
Parameters
address The memory address (integer)
231
UCS430-1
Reference information on C-SPY system macros
zone The memory zone name (string); for a list of available zones,
see C-SPY memory zones, page 120.
__readMemory32
Syntax __readMemory32(address, zone)
Parameters
address The memory address (integer)
zone The memory zone name (string); for a list of available
zones, see C-SPY memory zones, page 120.
__registerMacroFile
Syntax __registerMacroFile(filename)
Parameter
filename A file containing the macros to be registered (string). The
filename must include a path, which must either be absolute
or use argument variables. For information about argument
variables, see the IDE Project Management and Building
Guide.
Description Registers macros from a setup macro file. With this function you can register multiple
macro files during C-SPY startup.
UCS430-1
Using C-SPY macros
Example __registerMacroFile("c:\\testdir\\[Link]");
See also Registering and executing using setup macros and setup files, page 210.
__resetFile
Syntax __resetFile(fileHandle)
Parameter
fileHandle A macro variable used as filehandle by the __openFile
macro
__setAdvancedTriggerBreak
Syntax __setAdvancedTriggerBreak(type, condition, access, action, mask
cond_value)
233
UCS430-1
Reference information on C-SPY system macros
Return value
Result Value
Successful An unsigned integer uniquely identifying the breakpoint. This value
must be used to clear the breakpoint.
Unsuccessful 0
Table 28: __setAdvancedTriggerBreak return values
Applicability This system macro is only available in the C-SPY FET Debugger driver.
UCS430-1
Using C-SPY macros
__setCodeBreak
Syntax __setCodeBreak(location, count, condition, cond_type, action)
Parameters
location A string with a location description. This can be either:
● A source location on the form {filename}.[Link]
(for example {D:\\src\\prog.c}.12.9)
● An absolute location on the form zone:hexaddress or
simply hexaddress (for example Memory:0x42)
● An expression whose value designates a location (for
example main)
count The number of times that a breakpoint condition must be
fulfilled before a break occurs (integer)
condition The breakpoint condition (string)
cond_type The condition type; either “CHANGED” or “TRUE” (string)
action An expression, typically a call to a macro, which is evaluated
when the breakpoint is detected
Return value
Result Value
Successful An unsigned integer uniquely identifying the breakpoint. This value
must be used to clear the breakpoint.
Unsuccessful 0
Table 29: __setCodeBreak return values
Description Sets a code breakpoint, that is, a breakpoint which is triggered just before the processor
fetches an instruction at the specified location.
This example sets a code breakpoint on the label main in your source:
__setCodeBreak("main", 0, "1", "TRUE", "");
235
UCS430-1
Reference information on C-SPY system macros
__setConditionalBreak
Syntax __setConditionalBreak(location, type, operator, access, action,
mask, cond_value, cond_operator,
cond_access, cond_mask)
Return value
Result Value
Successful An unsigned integer uniquely identifying the breakpoint. This value
must be used to clear the breakpoint.
Unsuccessful 0
Table 30: __setConditionalBreak return values
UCS430-1
Using C-SPY macros
Applicability This system macro is only available in the C-SPY FET Debugger driver.
__setDataBreak
Syntax __setDataBreak(location, count, condition, cond_type, access,
action)
Parameters
location A string with a location description. This can be either:
● A source location on the form
{filename}.[Link] (for example
{D:\\src\\prog.c}.12.9), although this is not
very useful for data breakpoints
● An absolute location on the form zone:hexaddress
or simply hexaddress (for example Memory:0x42)
● An expression whose value designates a location (for
example my_global_variable).
count The number of times that a breakpoint condition must be
fulfilled before a break occurs (integer)
condition The breakpoint condition (string)
cond_type The condition type; either "CHANGED" or "TRUE" (string)
access The memory access type: "R" for read, "W" for write, or
"RW" for read/write
237
UCS430-1
Reference information on C-SPY system macros
Return value
Result Value
Successful An unsigned integer uniquely identifying the breakpoint. This value
must be used to clear the breakpoint.
Unsuccessful 0
Table 31: __setDataBreak return values
Description Sets a data breakpoint, that is, a breakpoint which is triggered directly after the processor
has read or written data at the specified location.
__setLogBreak
Syntax __setLogBreak(location, message, mesg_type, condition,
cond_type)
Parameters
location A string with a location description. This can be either:
● A source location on the form
{filename}.[Link] (for example
{D:\\src\\prog.c}.12.9)
● An absolute location on the form zone:hexaddress
or simply hexaddress (for example Memory:0x42)
● An expression whose value designates a location (for
example main)
message The message text
msg_type The message type; choose between:
TEXT, the message is written word for word.
ARGS, the message is interpreted as a comma-separated list
of C-SPY expressions or strings.
UCS430-1
Using C-SPY macros
Return value
Result Value
Successful An unsigned integer uniquely identifying the breakpoint. The same
value must be used when you want to clear the breakpoint.
Unsuccessful 0
Table 32: __setLogBreak return values
Description Sets a log breakpoint, that is, a breakpoint which is triggered when an instruction is
fetched from the specified location. If you have set the breakpoint on a specific machine
instruction, the breakpoint will be triggered and the execution will temporarily halt and
print the specified message in the C-SPY Debug Log window.
logOn()
{
logBp1 = __setLogBreak ("{C:\\temp\\Utilities.c}.23.1",
"\"Entering trace zone at :\", #PC:%X", "ARGS", "1", "TRUE");
logBp2 = __setLogBreak ("{C:\\temp\\Utilities.c}.30.1",
"Leaving trace zone...", "TEXT", "1", "TRUE");
}
logOff()
{
__clearBreak(logBp1);
__clearBreak(logBp2);
}
See also Formatted output, page 216 and Using breakpoints, page 87.
239
UCS430-1
Reference information on C-SPY system macros
__setRangeBreak
Syntax __setRangeBreak(start_loc, end_loc, end_cond, type, access,
action, action_when)
end_loc The end location. This can be either the same as for start_loc
above or the length of the range.
end_cond The type of end condition: "Location", "Length", or
"Automatic".
Return value
Result Value
Successful An unsigned integer uniquely identifying the breakpoint. This value
must be used to clear the breakpoint.
Unsuccessful 0
Table 33: __setRangeBreak return values
Applicability This system macro is only available in the C-SPY FET Debugger driver.
UCS430-1
Using C-SPY macros
__setSimBreak
Syntax __setSimBreak(location, access, action)
Parameters
location A string with a location description. This can be either:
● A source location on the form
{filename}.[Link] (for example
{D:\\src\\prog.c}.12.9)
● An absolute location on the form zone:hexaddress
or simply hexaddress (for example Memory:0x42)
● An expression whose value designates a location (for
example main)
access The memory access type: "R" for read or "W" for write
action An expression, typically a call to a macro function, which
is evaluated when the breakpoint is detected
Return value
Result Value
Successful An unsigned integer uniquely identifying the breakpoint. This value
must be used to clear the breakpoint.
Unsuccessful 0
Table 34: __setSimBreak return values
Description Use this system macro to set immediate breakpoints, which will halt instruction
execution only temporarily. This allows a C-SPY macro function to be called when the
processor is about to read data from a location or immediately after it has written data.
Instruction execution will resume after the action.
This type of breakpoint is useful for simulating memory-mapped devices of various
kinds (for instance serial ports and timers). When the processor reads at a
memory-mapped location, a C-SPY macro function can intervene and supply the
241
UCS430-1
Reference information on C-SPY system macros
__setTraceStartBreak
Syntax __setTraceStartBreak(location)
Parameters
location A string with a location description. This can be either:
● A source location on the form
{filename}.[Link] (for example
{D:\\src\\prog.c}.12.9)
● An absolute location on the form zone:hexaddress
or simply hexaddress (for example Memory:0x42)
● An expression whose value designates a location (for
example main)
Return value
Result Value
Successful An unsigned integer uniquely identifying the breakpoint. The same
value must be used when you want to clear the breakpoint.
Unsuccessful 0
Table 35: __setTraceStartBreak return values
Description Sets a breakpoint at the specified location. When that breakpoint is triggered, the trace
system is started.
traceOn()
{
startTraceBp = __setTraceStartBreak
("{C:\\TEMP\\Utilities.c}.23.1");
stopTraceBp = __setTraceStopBreak
("{C:\\temp\\Utilities.c}.30.1");
}
UCS430-1
Using C-SPY macros
traceOff()
{
__clearBreak(startTraceBp);
__clearBreak(stopTraceBp);
}
__setTraceStopBreak
Syntax __setTraceStopBreak(location)
Parameters
location A string with a location description. This can be either:
● A source location on the form
{filename}.[Link] (for example
{D:\\src\\prog.c}.12.9)
● An absolute location on the form zone:hexaddress
or simply hexaddress (for example Memory:0x42)
● An expression whose value designates a location (for
example main)
Return value
Result Value
Successful An unsigned integer uniquely identifying the breakpoint. The same
value must be used when you want to clear the breakpoint.
Unsuccessful int 0
Table 36: __setTraceStopBreak return values
Description Sets a breakpoint at the specified location. When that breakpoint is triggered, the trace
system is stopped.
243
UCS430-1
Reference information on C-SPY system macros
__sourcePosition
Syntax __sourcePosition(linePtr, colPtr)
Parameters
linePtr Pointer to the variable storing the line number
colPtr Pointer to the variable storing the column number
Return value
Result Value
Successful Filename string
Unsuccessful Empty ("") string
Table 37: __sourcePosition return values
Description If the current execution location corresponds to a source location, this macro returns the
filename as a string. It also sets the value of the variables, pointed to by the parameters,
to the line and column numbers of the source location.
__strFind
Syntax __strFind(macroString, pattern, position)
Parameters
macroString The macro string to search in
pattern The string pattern to search for
position The position where to start the search. The first position is
0
Return value The position where the pattern was found or -1 if the string is not found.
Description This macro searches a given string for the occurrence of another string.
UCS430-1
Using C-SPY macros
__subString
Syntax __subString(macroString, position, length)
Parameters
macroString The macro string from which to extract a substring
position The start position of the substring. The first position is 0.
length The length of the substring
Example __subString("Compiler", 0, 2)
__targetDebuggerVersion
Syntax __targetDebuggerVersion
Return value A string that represents the version number of the C-SPY debugger processor module.
Description This macro returns the version number of the C-SPY debugger processor module.
__toLower
Syntax __toLower(macroString)
Parameter
macroString Any macro string
245
UCS430-1
Reference information on C-SPY system macros
Description This macro returns a copy of the parameter string where all the characters have been
converted to lower case.
Example __toLower("IAR")
__toString
Syntax __toString(C_string, maxlength)
Parameter
string Any null-terminated C string
maxlength The maximum length of the returned macro string
Description This macro is used for converting C strings (char* or char[]) into macro strings.
__toUpper
Syntax __toUpper(macroString)
UCS430-1
Using C-SPY macros
Description This macro returns a copy of the parameter macroString where all the characters have
been converted to upper case.
Example __toUpper("string")
__unloadImage
Syntax __unloadImage(module_id)
Parameter
module_id An integer which represents a unique module identification, which is
retrieved as a return value from the corresponding __loadImage
C-SPY macro.
Return value
Value Result
module_id A unique module identification (the same as the input
parameter).
int 0 The unloading failed.
Table 38: __unloadImage return values
See also Loading multiple images, page 39 and Images, page 272.
__writeFile
Syntax __writeFile(file, value)
Parameters
fileHandle A macro variable used as filehandle by the __openFile
macro
value An integer
247
UCS430-1
Reference information on C-SPY system macros
Description Prints the integer value in hexadecimal format (with a trailing space) to the file file.
Note: The __fmessage statement can do the same thing. The __writeFile macro is
provided for symmetry with __readFile.
__writeFileByte
Syntax __writeFileByte(file, value)
Parameters
fileHandle A macro variable used as filehandle by the __openFile
macro
value An integer in the range 0-255
__writeMemory8, __writeMemoryByte
Syntax __writeMemory8(value, address, zone)
__writeMemoryByte(value, address, zone)
Parameters
value The value to be written (integer)
address The memory address (integer)
zone The memory zone name (string); for a list of available zones,
see C-SPY memory zones, page 120.
UCS430-1
Using C-SPY macros
__writeMemory16
Syntax __writeMemory16(value, address, zone)
Parameters
value The value to be written (integer)
address The memory address (integer)
zone The memory zone name (string); for a list of available zones,
see C-SPY memory zones, page 120.
__writeMemory32
Syntax __writeMemory32(value, address, zone)
Parameters
value The value to be written (integer)
address The memory address (integer)
zone The memory zone name (string); for a list of available zones,
see C-SPY memory zones, page 120.
249
UCS430-1
Reference information on C-SPY system macros
UCS430-1
The C-SPY Command
Line Utility—cspybat
This chapter describes how you can execute C-SPY® in batch mode, using the
C-SPY Command Line Utility—[Link]. More specifically, this means:
INVOCATION SYNTAX
The invocation syntax for cspybat is:
cspybat processor_DLL driver_DLL debug_file [cspybat_options]
--backend driver_options
Note: In those cases where a filename is required—including the DLL files—you are
recommended to give a full path to the filename.
Parameters
The parameters are:
Parameter Description
processor_DLL The processor-specific DLL file; available in 430\bin.
driver_DLL The C-SPY driver DLL file; available in 430\bin.
debug_file The object file that you want to debug (filename extension d43).
cspybat_options The command line options that you want to pass to cspybat. Note
that these options are optional. For information about each option,
see Descriptions of C-SPY command line options, page 255.
Table 39: cspybat parameters
251
UCS430-1
Using C-SPY in batch mode
Parameter Description
--backend Marks the beginning of the parameters to the C-SPY driver; all
options that follow will be sent to the driver. Note that this option is
mandatory.
driver_options The command line options that you want to pass to the C-SPY driver.
Note that some of these options are mandatory and some are
optional. For information about each option, see Descriptions of C-SPY
command line options, page 255.
Table 39: cspybat parameters (Continued)
Example
This example starts cspybat using the simulator driver:
EW_DIR\common\bin\cspybat EW_DIR\430\bin\[Link]
EW_DIR\430\bin\[Link] PROJ_DIR\myproject.d43 --plugin
EW_DIR\430\bin\[Link] --backend -d sim -B --cpu 430 -p
EW_DIR\430\bin\config\[Link]
where EW_DIR is the full path of the directory where you have installed IAR Embedded
Workbench
and where PROJ_DIR is the path of your project directory.
This example shows how to start cspybat using the FET debugger driver:
EW_DIR\common\bin\cspybat EW_DIR\430\bin\[Link]
EW_DIR\430\bin\[Link] PROJ_DIR\myproject.d43 --plugin
EW_DIR\430\bin\[Link] --backend -d fet -B --connection ti_usb
--derivative msp430F449 --erase_main_and_info
Note: The path to the 430\bin directory must be included in the environment path
when the parallel port FET or the TI USB FET is used.
OUTPUT
When you run cspybat, these types of output can be produced:
● Terminal output from cspybat itself
All such terminal output is directed to stderr. Note that if you run cspybat from
the command line without any arguments, the cspybat version number and all
available options including brief descriptions are directed to stdout and displayed
on your screen.
● Terminal output from the application you are debugging
All such terminal output is directed to stdout, provided that you have used the
--plugin option. See --plugin, page 264.
UCS430-1
The C-SPY Command Line Utility—cspybat
253
UCS430-1
Summary of C-SPY command line options
UCS430-1
The C-SPY Command Line Utility—cspybat
--allow_access_to_BSL
Syntax --allow_access_to_BSL
--allow_locked_flash_access
Syntax --allow_locked_flash_access
Description Use this option to enable erase/write access to locked flash memory.
255
UCS430-1
Descriptions of C-SPY command line options
--attach
Syntax --attach
Description Use this option to make the debugger attach to a running application at its current
location, without resetting the target system.
-B
Syntax -B
--backend
Syntax --backend {driver options}
Parameters
driver options Any option available to the C-SPY driver you are using.
Description Use this option to send options to the C-SPY driver. All options that follow --backend
will be passed to the C-SPY driver, and will not be processed by cspybat itself.
--connection
Syntax --connection Port
Parameters
Port The communication channel to be used; choose between:
ti_usb, ti_lpt, jlink, olimex, olimex_parallel,
elprotronic, softbaugh_lpt, softbaugh_usb, and
softbaugh_usb_pro.
UCS430-1
The C-SPY Command Line Utility—cspybat
Description Use this option to specify the communication channel to be used between C-SPY and
the target system.
Project>Options>Debugger>FET Debugger>Setup>Connection
--core
Syntax --core {430X|430Xv2}
Parameters
430X|430Xv2 The core you are using. For a description of the cores, see the
IAR C/C++ Compiler Reference Guide for MSP430.
Description Use this option to specify the core you are using. This option reflects the corresponding
compiler option.
--code_coverage_file
Syntax --code_coverage_file file
Parameters
file The name of the destination file for the code coverage
information.
Description Use this option to enable the generation of code coverage information. The code
coverage information will be generated after the execution has completed and you can
find it in the specified file.
Note that this option requires that the C-SPY driver you are using supports code
coverage. If you try to use this option with a C-SPY driver that does not support code
coverage, an error message will be directed to stderr.
257
UCS430-1
Descriptions of C-SPY command line options
--cycles
Syntax --cycles cycles
Parameters
cycles The number of cycles to run.
Description Use this option to specify the maximum number of cycles to run. If the target program
executes longer than the number of cycles specified, the target program will be aborted.
Using this option requires that the C-SPY driver you are using supports a cycle counter,
and that it can be sampled while executing.
-d
Syntax -d {sim|fet}
Parameters
sim Specifies the simulator driver.
fet Specifies the FET debugger driver.
--derivative
Syntax --derivative device
Parameters
device Specifies the device to be used.
Description Use this option to select the device for which you will build your application.
Project>Options>General Options>Target>Device
UCS430-1
The C-SPY Command Line Utility—cspybat
--disable_interrupts
Syntax --disable_interrupts
To set this option, choose Simulator>Interrupt Setup and deselect the Enable
interrupt simulation option.
--disable_memory_cache
Syntax --disable_memory_cache
Description Use this option to disable the memory cache in the FET debugger.
--download_only
Syntax --download_only
Description Use this option to download the code image without starting a debug session afterwards.
259
UCS430-1
Descriptions of C-SPY command line options
--eem
Syntax --eem {level}
Parameters
level Implementation level of Enhanced Emulation Module. Choose
between:
EMEX_HIGH
EMEX_MEDIUM
EMEX_LOW
EMEX_NONE
Description Use this option to specify the implementation level of Enhanced Emulation Module for
a MSP430 device. The default value is EMEX_NONE. The value of this option depends on
the device you are using.
This option is not available in the IDE.
--erase_main
Syntax --erase_main
Description Use this option to erase the main flash memory before download. The Information
memory is not erased.
--erase_main_and_info
Syntax --erase_main_and_info
UCS430-1
The C-SPY Command Line Utility—cspybat
Description Use this option to erase both flash memories—main and Information memory—before
download.
--erase_retain
Syntax --erase_retain
Description Use this option to make C-SPY read the main and Information memories into a buffer.
Only the flash segments that are needed are erased. If data that is to be written into a
segment matches the data on the target, the data on the target is left as is, and no
download is performed. The new data effectively replaces the old data, and unchanged
old data is retained.
--hardware_multiplier
Syntax --hardware_multiplier {16|32}
Parameters
16 The size of the multiplicands in bits.
Note: This parameter can only be used in combination with the
--hwmult_type parameters 1 and 2.
Description Use this option to generate code for the MSP430 hardware multiplier peripheral unit.
Use this option only when you have chosen a device with a hardware multiplier.
261
UCS430-1
Descriptions of C-SPY command line options
Note: This option requires that you also specify the --hwmult_type option.
--hwmult_type
Syntax --hwmult_type {1|2|4|8}
Parameters
1 16 bits
Note: This parameter can only be combined with the
--hardware_multiplier parameter 16.
4 32 bits
Note: This parameter can only be combined with the
--hardware_multiplier parameter 32.
Description Use this option to generate code for the MSP430 hardware multiplier peripheral unit.
Use this option only when you have chosen a device with a hardware multiplier.
Note: This option requires that you also specify the --hardware_multiplier
option.
UCS430-1
The C-SPY Command Line Utility—cspybat
--lptx
Syntax --lptx
Description Use this option to specify which parallel port the FET Debugger is connected to. x can
be 1, 2, or 3.
--macro
Syntax --macro filename
Parameters
filename The C-SPY macro file to be used (filename extension mac).
Description Use this option to specify a C-SPY macro file to be loaded before executing the target
application. This option can be used more than once on the command line.
--mapu
Syntax --mapu
Description Specify this option to use the segment information in the debug file for memory access
checking. During the execution, the simulator will then check for accesses to
unspecified ranges. If any such access is found, a message will be printed on stdout
and the execution will stop.
263
UCS430-1
Descriptions of C-SPY command line options
--odd_word_check
Syntax --odd_word_check
Description Use this option to make the simulator issue a warning if there is a word access to an odd
address.
-p
Syntax -p filename
Parameters
filename The device description file to be used.
Description Use this option to specify the device description file to be used.
--plugin
Syntax --plugin filename
Parameters
filename The plugin file to be used (filename extension dll).
Description Certain C/C++ standard library functions, for example printf, can be supported by
C-SPY—for example, the C-SPY Terminal I/O window—instead of by real hardware
devices. To enable such support in cspybat, a dedicated plugin module called
[Link] located in the 430\bin directory must be used.
Use this option to include this plugin during the debug session. This option can be used
more than once on the command line.
UCS430-1
The C-SPY Command Line Utility—cspybat
Note: You can use this option to include also other plugin modules, but in that case the
module must be able to work with cspybat specifically. This means that the C-SPY
plugin modules located in the common\plugin directory cannot normally be used with
cspybat.
--port
Syntax --port port
Parameters
port The serial port to be used, can be COMx or Automatic. x is
the number of the COM port.
Description Use this option to specify which serial port the FET Debugger is connected to.
Project>Options>Debugger>FET Debugger>Setup>Connection
--protocol
Syntax --protocol {spy-bi-wire|spy-bi-wire-jtag|4wire}
Parameters
spy-bi-wire The Spy-Bi-Wire JTAG protocol.
spy-bi-wire-jtag 4-wire JTAG protocol for devices that also support
Spy-Bi-Wire.
4wire The ordinary 4-wire JTAG protocol.
Description Use this option to specify the debug protocol. Spy-Bi-Wire works for the parallel port
FET module and the TI USB FET module.
265
UCS430-1
Descriptions of C-SPY command line options
--set_exit_breakpoint
Syntax --set_exit_breakpoint
--set_getchar_breakpoint
Syntax --set_getchar_breakpoint
--set_putchar_breakpoint
Syntax --set_putchar_breakpoint
--settlingtime
Syntax --settlingtime=milliseconds
UCS430-1
The C-SPY Command Line Utility—cspybat
Description Use this option to specify the delay between switching on the target VCC and starting
the identification of the MSP430 device. Give the value in milliseconds in the range
0-9999 ms. This option can only be used with a USB connection.
--silent
Syntax --silent
--timeout
Syntax --timeout milliseconds
Parameters
milliseconds The number of milliseconds before the execution stops.
Description Use this option to limit the maximum allowed execution time.
--use_emulated_breakpoints
Syntax --use_emulated_breakpoints
267
UCS430-1
Descriptions of C-SPY command line options
--use_virtual_breakpoints
Syntax --use_virtual_breakpoints
--vccvoltage
Syntax --vccvoltage=volts
Description Use this option to specify the voltage provided by the USB interface. Give the value in
Volts with one decimal’s precision in the range 1.0-4.0 V. This option can only be used
with a USB connection.
--verify_all
Syntax --verify_all
Description Use this option to verify that the downloaded code image can be read back from target
memory with the correct contents.
UCS430-1
Debugger options
This chapter describes the C-SPY® options available in the IAR Embedded
Workbench® IDE. More specifically, this means:
269
UCS430-1
Reference information on general debugger options
5 To restore all settings to the default factory settings, click the Factory Settings button.
6 When you have set all the required options, click OK in the Options dialog box.
Setup
The Setup options select the C-SPY driver, the setup macro file, and device description
file to use, and specify which default source code location to run to.
Driver
Selects the C-SPY driver for the target system you are using:
FET Debugger
Simulator
UCS430-1
Debugger options
Run to
Specifies the location C-SPY runs to when the debugger starts after a reset. By default,
C-SPY runs to the main function.
To override the default location, specify the name of a different location you want
C-SPY to run to. You can specify assembler labels or whatever can be evaluated as such,
for example function names.
If the option is deselected, the program counter will contain the regular hardware reset
address at each reset.
Setup macros
Registers the contents of a setup macro file in the C-SPY startup sequence. Select Use
macro file and specify the path and name of the setup file, for example
[Link]. If no extension is specified, the extension mac is assumed. A
browse button is available for your convenience.
271
UCS430-1
Reference information on general debugger options
Images
The Images options control the use of additional debug files to be downloaded.
If you want to download more than three images, use the related C-SPY macro, see
__loadImage, page 225.
For more information, see Loading multiple images, page 39.
UCS430-1
Debugger options
Extra Options
The Extra Options page provides you with a command line interface to C-SPY.
Plugins
The Plugins options select the C-SPY plugin modules to be loaded and made available
during debug sessions.
273
UCS430-1
Reference information on C-SPY driver options
Description
Describes the plugin module.
Location
Informs about the location of the plugin module.
Generic plugin modules are stored in the common\plugins directory. Target-specific
plugin modules are stored in the 430\plugins directory.
Originator
Informs about the originator of the plugin module, which can be modules provided by
IAR Systems or by third-party vendors.
Version
Informs about the version number.
UCS430-1
Debugger options
Connection
Controls the communication between C-SPY and the target device.
The C-SPY FET Debugger can communicate with the target device via a number of
different emulators. Select the emulator you are using.
If your emulator is connected to the host computer via a parallel port, you must also
specify which parallel port to use: Parallel port 1, Parallel port 2, or Parallel port 3. If
your emulator is connected to the host computer via a USB port, the debugger will
automatically connect to the correct port.
Some emulator drivers support multiple emulators connected to the same host computer.
Each emulator requires its own instance of IAR Embedded Workbench and each
instance must identify its emulator. To identify an emulator, click the browse button to
display a list of all detected emulators. To identify a connection, click the port in the list
and the Mode LED on the attached emulator will light up.
Debug protocol
Determines the debug interface to use:
Automatic selection Selects the debug interface automatically. (If Connection is set
to Automatic, C-SPY correctly determines which interface to
use.)
275
UCS430-1
Reference information on C-SPY driver options
Target VCC
Specify the voltage provided by the USB interface:
Override default Overrides the default voltage. To see what the default voltage
is, see Device Information window, page 50.
Target VCC Specify the voltage with one decimal’s precision in the range
1.0–4.0 V. This option can only be used with a USB
connection.
UCS430-1
Debugger options
Settling time Specify a delay that will be used between switching on the
target VCC and starting the identification of the MSP430
device.
Debug LPMx5
Enables debugging of applications that use the LPMx5 low-power mode.
Download
By default, C-SPY downloads the application to RAM or flash when a debug session
starts. The Download options let you modify the behavior of the download.
Verify download
Use this option to verify that the downloaded code image can be read back from target
memory with the correct contents.
277
UCS430-1
Reference information on C-SPY driver options
JTAG password
If a JTAG device is password-protected, supply the needed password here.
Breakpoints
The Breakpoints options control the use of breakpoints.
UCS430-1
Debugger options
For information, see Breakpoints in the C-SPY FET Debugger driver, page 90.
System breakpoints on
Controls the use of system breakpoints in the CLIB runtime environment. If the C-SPY
Terminal I/O window is not required or if you do not need a breakpoint on the exit
label, you can save hardware breakpoints by not reserving system breakpoints. Select or
deselect the options exit, putchar, and getchar respectively, if you want, or do not want,
C-SPY to use system breakpoints for these. For more information, see Breakpoint
consumers, page 91.
In the DLIB runtime environment, C-SPY will always set a system breakpoint on the
__DebugBreak label. You cannot disable this behavior.
279
UCS430-1
Reference information on C-SPY driver options
Peripheral simulation
These options set up peripheral simulation, which requires a plug-in from a third-party
vendor. For information, see the PDF EW_PeripheralSimulationGuide.pdf in the
EW_DIR\430\doc\ directory and the examples in the
EW_DIR\430\plugins\simulation directory.
UCS430-1
Additional information on
C-SPY drivers
This chapter describes the additional menus and features provided by the
C-SPY® drivers. More specifically, this means:
● Resolving problems.
Simulator menu
When you use the simulator driver, the Simulator menu is added to the menu bar.
281
UCS430-1
Reference information on the C-SPY FET Debugger driver
Interrupt Setup Displays a dialog box where you can configure C-SPY
interrupt simulation; see Interrupt Setup dialog box, page
198.
Forced Interrupts Opens a window from where you can instantly trigger an
interrupt; see Forced Interrupt window, page 202.
Interrupt Log Opens a window which displays the status of all defined
interrupts; see Interrupt Log window, page 203.
Memory Access Setup Displays a dialog box to simulate memory access checking
by specifying memory areas with different access types; see
Memory Access Setup dialog box, page 137.
Trace Opens a window which displays the collected trace data; see
Trace window, page 146.
Function Trace Opens a window which displays the trace data for function
calls and function returns; see Function Trace window, page
148.
Function Profiler Opens a window which shows timing information for the
functions; see Function Profiler window, page 163.
Breakpoint Usage Displays a dialog box which lists all active breakpoints; see
Breakpoint Usage dialog box, page 100.
Timeline Opens a window which displays trace data for interrupts and
for the call stack as graphs; see Timeline window, page 149.
UCS430-1
Additional information on C-SPY drivers
Emulator menu
When you are using the C-SPY FET Debugger driver, the Emulator menu is added to
the menu bar.
283
UCS430-1
Reference information on the C-SPY FET Debugger driver
Init New Device Initializes the device according to the settings in the
Projects>Options>FET Debugger category. The current
program file is downloaded to the device memory, and the
device is then reset. This command can be used to program
multiple devices with the same program from within the
same C-SPY session.
It is not possible to choose Init New Device while the device
is operating, thus the command will be dimmed.
Secure - Blow JTAG Blows the fuse on the target device. After the fuse is blown,
Fuse no communication with the device is possible.
Only available if you are using a USB-connected debug
probe.
Breakpoint Usage Displays a dialog box which lists all active breakpoints; see
Breakpoint Usage dialog box, page 100.
Advanced> Lets you control the clocks on the device. Depending on the
Clock Control hardware support, either the General Clock Control dialog
box or the Extended Clock Control dialog box is
displayed; see General Clock Control dialog box, page 285
and Extended Clock Control dialog box, page 286,
respectively.
Advanced> Specifies the device to be emulated. The device must be
Emulation Mode reset (or reinitialized by using the menu command Init New
Device) following a change to the emulation mode.
Advanced> Displays the Memory Dump dialog box, which lets you
Memory Dump write device memory contents to a file; see Memory Dump
dialog box, page 140.
Advanced> Displays the Breakpoint combiner dialog box, which lets
Breakpoint Combiner you combine two already defined breakpoints; see
Breakpoint combiner dialog box, page 115.
State Storage Control Opens the State Storage Control window, which lets you
define the use of the state storage module; see State Storage
Control window, page 174.
State Storage Window Opens the State Storage window which contains state
storage information according to your definitions; see State
Storage window, page 175.
UCS430-1
Additional information on C-SPY drivers
Sequencer Control Opens the Sequencer Control window, which lets you define
a state machine; see Sequencer Control window, page 181.
“Power on” Reset The device is reset by cycling power to the device.
GIE on/off Clears the General Interrupt Enable bit (GIE) in the
Processor Status register.
Cycle Counter for 5xx Opens the Cycle Counter 5xx Control window, where you
can define and use the advanced cycle counter on the
MSP430x5xx devices; see Cycle Counter 5xx Control
window, page 187.
Leave Target Running Leaves the application running on the target hardware after
the debug session is closed.
Force Single Stepping Forces single step debugging.
Force hardware Forces an RST/NMI clear reset when the Reset button is
RST/NMI pressed.
Note: Not all Emulator>Advanced submenus are available on all MSP430 devices.
285
UCS430-1
Resolving problems
Use this dialog box for module level control over the clocks of the device.
Select the clock modules you want to stop when the execution stops. The other clocks
will keep running.
Which clock modules that are displayed depends on the available clocks on the
connected device.
Resolving problems
Debugging 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.
To troubleshoot the Flash Emulation Tool, see appendix A in the document
MSP-FET430 Flash Emulation Tool User’s Guide at the Texas Instruments web site,
[Link]. The document has the literature number SLAU138K.
UCS430-1
Additional information on C-SPY drivers
287
UCS430-1
Resolving problems
UCS430-1
Index
Index
assembler symbols, using in C-SPY expressions . . . . . . . . 73
A assembler variables, viewing. . . . . . . . . . . . . . . . . . . . . . . . 75
Abort (Report Assert option) . . . . . . . . . . . . . . . . . . . . . . . 68 assumptions, programming experience . . . . . . . . . . . . . . . . 19
Absolute address (Type setting) . . . . . . . . . . . . . . . . . . . . 114 --attach (C-SPY command line option) . . . . . . . . . . . . . . . 256
absolute location, specifying for a breakpoint . . . . . . . . . . 114 Attach to running target (C-SPY FET option). . . . . . . . . . 276
Access type (Advanced Trigger breakpoints option) . . . . . 113 Auto Scroll (Timeline window context menu) . . . . . . . . . 151
Access Type (Data breakpoints option) . . . . . . . . . . . . . . . 104 Auto window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Access type (Edit Memory Access option) . . . . . . . . . . . . 139 Autostep settings dialog box . . . . . . . . . . . . . . . . . . . . . . . . 69
Access Type (Immediate breakpoints option) . . . . . . . . . . 106 Autostep (Debug menu) . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Access (Conditional breakpoints option) . . . . . . . . . . . . . 110
Action (Advanced Trigger breakpoints option) . . . . . . . . . 113
Action (Code breakpoints option) . . . . . . . . . . . . . . . . . . . 102
B
Action (Conditional breakpoints option) . . . . . . . . . . . . . . 111 -B (C-SPY command line option) . . . . . . . . . . . . . . . . . . . 256
Action (Data breakpoints option) . . . . . . . . . . . . . . . . . . . 105 --backend (C-SPY command line option) . . . . . . . . . . . . . 256
Action (Immediate breakpoints option) . . . . . . . . . . . . . . 106 backtrace information
Action (Sequencer option) . . . . . . . . . . . . . . . . . . . . . . . . 182 generated by compiler . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Add to Watch Window viewing in Call Stack window . . . . . . . . . . . . . . . . . . . . 62
(Symbolic Memory window context menu) . . . . . . . . . . . 132 batch mode, using C-SPY in . . . . . . . . . . . . . . . . . . . . . . . 251
Add (Watch window context menu) . . . . . . . . . . . . . . . . . . 79 Big Endian (Memory window context menu) . . . . . . . . . . 125
Address Range (Find in Trace option) . . . . . . . . . . . . . . . 156 blocks, in C-SPY macros . . . . . . . . . . . . . . . . . . . . . . . . . 216
Advanced Trigger breakpoints dialog box . . . . . . . . . . . . 112 bold style, in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
advanced trigger breakpoints, overview . . . . . . . . . . . . . . . 89 Break At (Advanced Trigger breakpoints option) . . . . . . . 112
Advanced (Sequencer option) . . . . . . . . . . . . . . . . . . . . . . 182 Break At (Code breakpoints option) . . . . . . . . . . . . . . . . . 101
Advanced>Breakpoint Combiner (Emulator menu) . . . . . 284 Break At (Conditional breakpoints option) . . . . . . . . . . . . 109
Advanced>Clock Control (Emulator menu) . . . . . . . . . . . 284 Break At (Data breakpoints option) . . . . . . . . . . . . . . . . . 104
Advanced>Emulation Mode (Emulator menu) . . . . . . . . . 284 Break At (Immediate breakpoints option) . . . . . . . . . . . . . 106
Advanced>Memory Dump (Emulator menu) . . . . . . . . . . 284 Break At (Log breakpoints option) . . . . . . . . . . . . . . . . . . 103
Allow erase/write access to locked Break (Debug menu) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
flash memory (C-SPY FET option) . . . . . . . . . . . . . . . . . 277 Breakpoint combiner dialog box . . . . . . . . . . . . . . . . . . . . 115
Allow erase/write access to breakpoint condition, example . . . . . . . . . . . . . . . . . . . . . . 97
BSL flash memory (C-SPY FET option) . . . . . . . . . . . . . 277 Breakpoint Usage dialog box . . . . . . . . . . . . . . . . . . . . . . 100
--allow_access_to_BSL (C-SPY command line option) . . 255 Breakpoint Usage (Emulator menu) . . . . . . . . . . . . . . . . . 284
--allow_locked_flash_access Breakpoint Usage (Simulator menu) . . . . . . . . . . . . . . . . . 282
(C-SPY command line option) . . . . . . . . . . . . . . . . . . . . . 255 breakpoints
Ambiguous symbol (Resolve Symbol Ambiguity option) . . 85 advanced trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
AND (Operation setting). . . . . . . . . . . . . . . . . . . . . . . . . . 129 example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
application flow, monitoring . . . . . . . . . . . . . . . . . . . . . . . 171 code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Applications (Cycle Counter 5xx option) . . . . . . . . . . . . . 188 example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
application, built outside the IDE . . . . . . . . . . . . . . . . . . . . 38
assembler labels, viewing . . . . . . . . . . . . . . . . . . . . . . . . . . 75
289
UCS430-1
conditional . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Immediate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
using . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
connecting a C-SPY macro . . . . . . . . . . . . . . . . . . . . . 212 Trace Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
consumers of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Trace Stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 Breakpoints window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 Breakpoints (FET debugger options) . . . . . . . . . . . . . . . . 278
description of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Browse (Trace toolbar) . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
disabling used by Stack window . . . . . . . . . . . . . . . . . . 93
emulated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
configuring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 C
icons for in the IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 C function information, in C-SPY. . . . . . . . . . . . . . . . . . . . 55
immediate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 C symbols, using in C-SPY expressions . . . . . . . . . . . . . . . 73
in Memory window . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 C variables, using in C-SPY expressions . . . . . . . . . . . . . . 73
listing all . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 call chain, displaying in C-SPY . . . . . . . . . . . . . . . . . . . . . 55
log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Call stack information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Call Stack Log (Timeline window context menu) . . . . . . . 151
range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Call Stack window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 for backtrace information . . . . . . . . . . . . . . . . . . . . . . . . 56
reasons for using . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 call stack, monitoring in Timeline window . . . . . . . . . . . . 150
setting __cancelAllInterrupts (C-SPY system macro) . . . . . . . . . 221
in memory window . . . . . . . . . . . . . . . . . . . . . . . . . . 95 __cancelInterrupt (C-SPY system macro) . . . . . . . . . . . . . 221
using system macros . . . . . . . . . . . . . . . . . . . . . . . . . 96 Check for word access on odd address
using the dialog box . . . . . . . . . . . . . . . . . . . . . . . . . 94 (C-SPY simulator option) . . . . . . . . . . . . . . . . . . . . . . . . . 280
single-stepping if not available. . . . . . . . . . . . . . . . . . . . 36 Clear All (Debug Log window context menu) . . . . . . . . . . 67
toggling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Clear trace data (Trace toolbar) . . . . . . . . . . . . . . . . . . . . . 147
trace start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Clear (Cycle Counter 5xx option) . . . . . . . . . . . . . . . . . . . 189
example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 __clearBreak (C-SPY system macro) . . . . . . . . . . . . . . . . 221
trace stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 CLIB, documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 __closeFile (C-SPY system macro) . . . . . . . . . . . . . . . . . 222
types of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 code breakpoints, overview . . . . . . . . . . . . . . . . . . . . . . . . . 88
useful tips. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Code Coverage window . . . . . . . . . . . . . . . . . . . . . . . . . . 168
virtual. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Code Coverage (Disassembly window context menu) . . . . 60
configuring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 code execution, tracking progress of . . . . . . . . . . . . . . . . . 167
Breakpoints dialog box --code_coverage (C-SPY command line option) . . . . . . . . 257
Advanced Trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 command line options
Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 for batch operations . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Conditional . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 interface in IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 typographic convention for . . . . . . . . . . . . . . . . . . . . . . 23
UCS430-1
Index
291
UCS430-1
Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 Device description file (Use ranges based on setting) . . . . 137
Setup (FET) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 device description files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Setup (general) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 definition of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Setup (simulator) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 memory zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
C-SPYLink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 modifying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
C++ terminology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 register zone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
specifying interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . 229
UCS430-1
Index
293
UCS430-1
Forced Interrupt window . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Init New Device (Emulator menu) . . . . . . . . . . . . . . . . . . 284
Forced Interrupts (Simulator menu) . . . . . . . . . . . . . . . . . 282 input formats, C-SPY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
formats, C-SPY input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Input Mode dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Function Profiler window . . . . . . . . . . . . . . . . . . . . . . . . . 163 input, special characters in Terminal I/O window . . . . . . . . 64
Function Profiler (Simulator menu) . . . . . . . . . . . . . . . . . 282 installation directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Function Trace window. . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Instruction Profiling (Disassembly window context menu) . 60
Function Trace (Simulator menu) . . . . . . . . . . . . . . . . . . . 282 Intel-extended, C-SPY input format . . . . . . . . . . . . . . . 27, 30
functions, C-SPY running to when starting . . . . . . . . . 36, 271 Interrupt Log window . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
fuse, blowing on the target device . . . . . . . . . . . . . . . . . . . 284 Interrupt Log (Simulator menu) . . . . . . . . . . . . . . . . . . . . 282
Interrupt Setup dialog box . . . . . . . . . . . . . . . . . . . . . . . . 198
I L
icons, in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
if else (macro statement) . . . . . . . . . . . . . . . . . . . . . . . . . . 215 labels (assembler), viewing . . . . . . . . . . . . . . . . . . . . . . . . . 75
if (macro statement) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 LCD Settings dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Ignore (Report Assert option) . . . . . . . . . . . . . . . . . . . . . . . 69 LCD window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
illegal memory accesses, checking for . . . . . . . . . . . . . . . 122 Leave Target Running (Emulator menu) . . . . . . . . . . . . . . 285
Images window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Length (Fill option). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Images, loading multiple . . . . . . . . . . . . . . . . . . . . . . . . . . 272 lightbulb icon, in this guide . . . . . . . . . . . . . . . . . . . . . . . . . 23
immediate breakpoints, overview . . . . . . . . . . . . . . . . . . . . 89 Little Endian (Memory window context menu) . . . . . . . . 125
Include (Log File option) . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Live Watch window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
UCS430-1
Index
__loadImage(C-SPY system macro) . . . . . . . . . . . . . . . . . 225 Memory Restore (Memory window context menu). . . . . . 126
loading multiple images . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Memory Save dialog box . . . . . . . . . . . . . . . . . . . . . . . . . 127
list of currently loaded . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Memory Save (Memory window context menu) . . . . . . . . 126
Locals window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Memory window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
log breakpoints, overview . . . . . . . . . . . . . . . . . . . . . . . . . . 88 memory zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Log File dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 in device description file . . . . . . . . . . . . . . . . . . . . . . . 121
Logging>Set Log file (Debug menu) . . . . . . . . . . . . . . . . . 46 __memoryRestore (C-SPY system macro) . . . . . . . . . . . . 226
Logging>Set Terminal I/O Log file (Debug menu) . . . . . . . 46 __memorySave (C-SPY system macro) . . . . . . . . . . . . . . 226
loop statements, in C-SPY macros . . . . . . . . . . . . . . . . . . 215 Memory>Restore (Debug menu) . . . . . . . . . . . . . . . . . . . . 45
--lpt1 (C-SPY command line option) . . . . . . . . . . . . . . . . 263 Memory>Save (Debug menu) . . . . . . . . . . . . . . . . . . . . . . . 45
--lpt2 (C-SPY command line option) . . . . . . . . . . . . . . . . 263 menu bar, C-SPY-specific . . . . . . . . . . . . . . . . . . . . . . . . . . 44
--lpt3 (C-SPY command line option) . . . . . . . . . . . . . . . . 263 Message (Log breakpoints option) . . . . . . . . . . . . . . . . . . 103
migration, from earlier IAR compilers . . . . . . . . . . . . . . . . 22
295
UCS430-1
options profiling information, on functions and instructions . . . . . 159
in the IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 program execution, in C-SPY . . . . . . . . . . . . . . . . . . . . . . . 51
on the command line . . . . . . . . . . . . . . . . . . . . . . . . . . 255 program flow, monitoring . . . . . . . . . . . . . . . . . . . . . . . . . 171
Options (Stack window context menu) . . . . . . . . . . . . . . . 134 program states, monitoring . . . . . . . . . . . . . . . . . . . . . . . . 171
OR (Operation setting) . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 programming experience. . . . . . . . . . . . . . . . . . . . . . . . . . . 19
__orderInterrupt (C-SPY system macro). . . . . . . . . . . . . . 229 projects, for debugging externally built applications . . . . . . 38
--protocol (C-SPY command line option) . . . . . . . . . . . . . 265
UCS430-1
Index
Reset States (Sequencer option) . . . . . . . . . . . . . . . . . . . . 182 __setSimBreak (C-SPY system macro) . . . . . . . . . . . . . . 241
Reset Trigger (Sequencer option) . . . . . . . . . . . . . . . . . . . 182 Settling time (C-SPY FET option) . . . . . . . . . . . . . . . . . . 277
Reset (Debug menu) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 --settlingtime (C-SPY command line option) . . . . . . . . . . 266
__resetFile (C-SPY system macro) . . . . . . . . . . . . . . . . . . 233 __setTraceStartBreak (C-SPY system macro). . . . . . . . . . 242
Resolve Source Ambiguity dialog box . . . . . . . . . . . . . . . 116 __setTraceStopBreak (C-SPY system macro) . . . . . . . . . . 243
Restore (Memory Restore option) . . . . . . . . . . . . . . . . . . . 128 setup macro functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Resynchronize JTAG (Emulator menu). . . . . . . . . . . . . . . 283 reserved names. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Retain unchanged memory (C-SPY FET option) . . . . . . . 278 Setup macros (debugger option) . . . . . . . . . . . . . . . . . . . . 271
return (macro statement) . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Setup (C-SPY simulator options) . . . . . . . . . . . . . . . . . . . 279
ROM-monitor, definition of . . . . . . . . . . . . . . . . . . . . . . . . 29 Setup (FET debugger options) . . . . . . . . . . . . . . . . . . . . . 275
RTOS awareness debugging . . . . . . . . . . . . . . . . . . . . . . . . 27 Setup (general C-SPY options) . . . . . . . . . . . . . . . . . . . . . 270
RTOS awareness (C-SPY plugin module) . . . . . . . . . . . . . . 27 Setup (simulator options) . . . . . . . . . . . . . . . . . . . . . . . . . 279
Run to Cursor (Call Stack window context menu) . . . . . . . 63 --set_exit_breakpoint (C-SPY command line option) . . . . 266
Run to Cursor (Debug menu) . . . . . . . . . . . . . . . . . . . . . . . 45 --set_getchar_breakpoint (C-SPY command line option) . 266
Run to Cursor (Disassembly window context menu) . . . . . 60 --set_putchar_breakpoint (C-SPY command line option) . 266
Run to Cursor, command for executing . . . . . . . . . . . . . . . . 55 SFR, using as assembler symbols . . . . . . . . . . . . . . . . . . . . 73
Run to (C-SPY option) . . . . . . . . . . . . . . . . . . . . . . . . 36, 271 Show all images (Images window context menu) . . . . . . . . 48
Show all variables with
static storage duration (Select Statics option) . . . . . . . . . . . 82
S Show Arguments (Call Stack window context menu) . . . . . 63
Save (Memory Save option) . . . . . . . . . . . . . . . . . . . . . . . 127 Show As (Watch window context menu) . . . . . . . . . . . . . . 79
Save (Trace toolbar) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Show offsets (Stack window context menu) . . . . . . . . . . . 134
Secure - Blow JTAG Fuse (Emulator menu) . . . . . . . . . . . 284 Show only (Image window context menu) . . . . . . . . . . . . . 48
Select All (Debug Log window context menu) . . . . . . . . . . 67 Show selected variables only (Select Statics option) . . . . . . 83
Select Graphs (Timeline window context menu) . . . . . . . . 152 Show variables (Stack window context menu) . . . . . . . . . 134
Select plugins to load (debugger option) . . . . . . . . . . . . . . 274 --silent (C-SPY command line option) . . . . . . . . . . . . . . . 267
Select Statics dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 simulating interrupts, enabling/disabling . . . . . . . . . . . . . 199
Sequencer Control window . . . . . . . . . . . . . . . . . . . . . . . . 181 simulator driver, selecting . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Sequencer Control (Emulator menu). . . . . . . . . . . . . . . . . 285 Simulator menu, reference information. . . . . . . . . . . . . . . 281
sequencer, setting up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 Simulator (debugger option) . . . . . . . . . . . . . . . . . . . . . . . 270
Set Data Breakpoint (Memory window context menu) . . . 126 simulator, introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Set Next Statement (Debug menu) . . . . . . . . . . . . . . . . . . . 45 Size (Code breakpoints option) . . . . . . . . . . . . . . . . . . . . . 102
Set Next Statement (Disassembly window context menu) . 61 Size (Data breakpoints option) . . . . . . . . . . . . . . . . . . . . . 105
__setAdvancedTriggerBreak (C-SPY system macro) . . . . 233 sizeof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
__setCodeBreak (C-SPY system macro). . . . . . . . . . . . . . 235 software breakpoints in FET debugger . . . . . . . . . . . . . . . . 91
__setConditionalBreak (C-SPY system macro) . . . . . . . . 236 Source location (Type setting) . . . . . . . . . . . . . . . . . . . . . 115
__setDataBreak (C-SPY system macro) . . . . . . . . . . . . . . 237 __sourcePosition (C-SPY system macro) . . . . . . . . . . . . . 244
__setLogBreak (C-SPY system macro) . . . . . . . . . . . . . . 238 special function registers (SFR)
__setRangeBreak (C-SPY system macro) . . . . . . . . . . . . . 240 description files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
using as assembler symbols . . . . . . . . . . . . . . . . . . . . . . 73
297
UCS430-1
stack usage, computing . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Terminal IO Log Files (Terminal IO Log Files option) . . . . 65
Stack window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Terminal I/O Log Files dialog box . . . . . . . . . . . . . . . . . . . 64
standard C, sizeof operator in C-SPY . . . . . . . . . . . . . . . . . 74 Terminal I/O window . . . . . . . . . . . . . . . . . . . . . . . . . . 56, 63
Start address (Edit Memory Access option) . . . . . . . . . . . 139 terminology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Start address (Fill option) . . . . . . . . . . . . . . . . . . . . . . . . . 129 Text search (Find in Trace option) . . . . . . . . . . . . . . . . . . 156
Start address (Memory Save option) . . . . . . . . . . . . . . . . . 127 Time Axis Unit (Timeline window context menu) . . . . . . 152
Start (Cycle Counter 5xx option) . . . . . . . . . . . . . . . . . . . 189 Timeline window (trace) . . . . . . . . . . . . . . . . . . . . . . . . . . 149
state storage Timeline (Simulator menu) . . . . . . . . . . . . . . . . . . . . . . . . 282
setting up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 --timeout (C-SPY command line option) . . . . . . . . . . . . . 267
starting using the sequencer . . . . . . . . . . . . . . . . . . . . . 177 timer interrupt, example . . . . . . . . . . . . . . . . . . . . . . . . . . 196
State Storage Control window . . . . . . . . . . . . . . . . . . . . . 174 Toggle Breakpoint (Code)
State Storage Control (Emulator menu) . . . . . . . . . . . . . . 284 (Call Stack window context menu) . . . . . . . . . . . . . . . . . . . 63
State Storage window . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 Toggle Breakpoint (Code)
State Storage Window (Emulator menu) . . . . . . . . . . . . . . 284 (Disassembly window context menu) . . . . . . . . . . . . . . . . . 61
Statics window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Toggle Breakpoint (Log)
stdin and stdout, redirecting to C-SPY window . . . . . . . . . 63 (Call Stack window context menu) . . . . . . . . . . . . . . . . . . . 63
Step Into (Debug menu) . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Toggle Breakpoint (Log)
Step Into, description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 (Disassembly window context menu) . . . . . . . . . . . . . . . . . 61
Step Out (Debug menu) . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Toggle Breakpoint (Trace Start)
(Disassembly window context menu) . . . . . . . . . . . . . . . . . 61
Step Out, description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Toggle Breakpoint (Trace Stop)
Step Over (Debug menu) . . . . . . . . . . . . . . . . . . . . . . . . . . 45
(Disassembly window context menu) . . . . . . . . . . . . . . . . . 61
Step Over, description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Toggle source (Trace toolbar) . . . . . . . . . . . . . . . . . . . . . . 147
step points, definition of . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
__toLower (C-SPY system macro) . . . . . . . . . . . . . . . . . . 245
Stop address (Memory Save option) . . . . . . . . . . . . . . . . . 127
tools icon, in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Stop Debugging (Debug menu). . . . . . . . . . . . . . . . . . . . . . 45
__toString (C-SPY system macro) . . . . . . . . . . . . . . . . . . 246
Stop (Cycle Counter 5xx option) . . . . . . . . . . . . . . . . . . . 189
__toUpper (C-SPY system macro) . . . . . . . . . . . . . . . . . . 246
stopping execution using the sequencer . . . . . . . . . . . . . . 177
trace data
__strFind (C-SPY system macro) . . . . . . . . . . . . . . . . . . . 244
definition of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
__subString (C-SPY system macro) . . . . . . . . . . . . . . . . . 245
searching in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Symbolic Memory window . . . . . . . . . . . . . . . . . . . . . . . . 130
Trace Expressions window . . . . . . . . . . . . . . . . . . . . . . . . 154
Symbols window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
trace start and stop breakpoints, overview . . . . . . . . . . . . . . 88
symbols, using in C-SPY expressions . . . . . . . . . . . . . . . . . 72
Trace Start breakpoints dialog box . . . . . . . . . . . . . . . . . . 152
System breakpoints on (C-SPY FET option) . . . . . . . . . . 279
Trace Stop breakpoints dialog box . . . . . . . . . . . . . . . . . . 153
Trace window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
T Trace (Simulator menu) . . . . . . . . . . . . . . . . . . . . . . . . . . 282
trace, state storage being variant of . . . . . . . . . . . . . . . . . . 171
target system, definition of . . . . . . . . . . . . . . . . . . . . . . . . . 29 trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Target VCC (C-SPY FET option) . . . . . . . . . . . . . . . . . . . 276 Type (Advanced Trigger breakpoints option) . . . . . . . . . . 112
__targetDebuggerVersion (C-SPY system macro) . . . . . . 245 Type (Conditional breakpoints option) . . . . . . . . . . . . . . . 110
UCS430-1
Index
V Z
Value (Advanced Trigger breakpoints option). . . . . . . . . . 113 zone
Value (Fill option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 defined in device description file . . . . . . . . . . . . . . . . . 121
variables in C-SPY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
effects of optimizations . . . . . . . . . . . . . . . . . . . . . . . . . 74 Zone (Edit Memory Access option) . . . . . . . . . . . . . . . . . 139
information, limitation on . . . . . . . . . . . . . . . . . . . . . . . 74 Zone (Fill option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
using in C-SPY expressions . . . . . . . . . . . . . . . . . . . . . . 73 Zone (Memory Restore option) . . . . . . . . . . . . . . . . . . . . . 128
variance (interrupt property), definition of . . . . . . . . . . . . 193 Zone (Memory Save option) . . . . . . . . . . . . . . . . . . . . . . . 127
Variance % (Edit Interrupt option) . . . . . . . . . . . . . . . . . . 201 Zone (Memory window context menu) . . . . . . . . . . . . . . . 125
--vccvoltage (C-SPY command line option) . . . . . . . . . . . 268 Zoom (Timeline window context menu) . . . . . . . . . . . . . . 151
Verify download (C-SPY FET option) . . . . . . . . . . . . . . . 277
--verify_all (C-SPY command line option) . . . . . . . . . . . . 268
version, of IAR Embedded Workbench . . . . . . . . . . . . . . . . . 2 Symbols
virtual breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 __cancelAllInterrupts (C-SPY system macro) . . . . . . . . . 221
configuring. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 __cancelInterrupt (C-SPY system macro) . . . . . . . . . . . . . 221
visualSTATE, C-SPY plugin module for . . . . . . . . . . . . . . . 30 __clearBreak (C-SPY system macro) . . . . . . . . . . . . . . . . 221
__closeFile (C-SPY system macro) . . . . . . . . . . . . . . . . . 222
299
UCS430-1
__evaluate (C-SPY system macro) . . . . . . . . . . . . . . . . . . 224 __writeMemory8 (C-SPY system macro) . . . . . . . . . . . . . 248
__fmessage (C-SPY macro statement) . . . . . . . . . . . . . . . 216 __writeMemory16 (C-SPY system macro) . . . . . . . . . . . . 249
__isBatchMode (C-SPY system macro) . . . . . . . . . . . . . . 224 __writeMemory32 (C-SPY system macro) . . . . . . . . . . . . 249
__loadImage (C-SPY system macro) . . . . . . . . . . . . . . . . 225 -B (C-SPY command line option) . . . . . . . . . . . . . . . . . . . 256
__memoryRestore (C-SPY system macro) . . . . . . . . . . . . 226 -d (C-SPY command line option) . . . . . . . . . . . . . . . . . . . 258
__memorySave (C-SPY system macro) . . . . . . . . . . . . . . 226 -p (C-SPY command line option) . . . . . . . . . . . . . . . . . . . 264
__message (C-SPY macro statement) . . . . . . . . . . . . . . . . 216 --allow_access_to_BSL (C-SPY command line option) . . 255
__openFile (C-SPY system macro) . . . . . . . . . . . . . . . . . . 227 --allow_locked_flash_access
__orderInterrupt (C-SPY system macro). . . . . . . . . . . . . . 229 (C-SPY command line option) . . . . . . . . . . . . . . . . . . . . . 255
__popSimulatorInterruptExecutingStack (C-SPY --attach (C-SPY command line option) . . . . . . . . . . . . . . . 256
system macro) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 --backend (C-SPY command line option) . . . . . . . . . . . . . 256
__readFile (C-SPY system macro) . . . . . . . . . . . . . . . . . . 230 --code_coverage (C-SPY command line option) . . . . . . . . 257
__readFileByte (C-SPY system macro) . . . . . . . . . . . . . . 231 --connection (C-SPY command line option) . . . . . . . . . . . 256
__readMemoryByte (C-SPY system macro) . . . . . . . . . . . 231 --core (C-SPY command line option) . . . . . . . . . . . . . . . . 257
__readMemory8 (C-SPY system macro) . . . . . . . . . . . . . 231 --cycles (C-SPY command line option) . . . . . . . . . . . . . . 258
__readMemory16 (C-SPY system macro) . . . . . . . . . . . . 231 --derivative (C-SPY command line option) . . . . . . . . . . . . 258
__readMemory32 (C-SPY system macro) . . . . . . . . . . . . 232 --disable_interrupts (C-SPY command line option) . . . . . 259
__registerMacroFile (C-SPY system macro). . . . . . . . . . . 232 --disable_memory_cache (C-SPY command line option) . 259
__resetFile (C-SPY system macro) . . . . . . . . . . . . . . . . . . 233 --download_only (C-SPY command line option) . . . . . . . 259
__setAdvancedTriggerBreak (C-SPY system macro) . . . . 233 --eem (C-SPY command line option) . . . . . . . . . . . . . . . . 260
__setCodeBreak (C-SPY system macro). . . . . . . . . . . . . . 235 --erase_main (C-SPY command line option) . . . . . . . . . . 260
__setConditionalBreak (C-SPY system macro) . . . . . . . . 236 --erase_main_and_info (C-SPY command line option) . . 260
__setDataBreak (C-SPY system macro) . . . . . . . . . . . . . . 237 --erase_retain (C-SPY command line option) . . . . . . . . . . 261
__setLogBreak (C-SPY system macro) . . . . . . . . . . . . . . 238 --hardware_multiplier (C-SPY command line option) . . . 261
__setRangeBreak (C-SPY system macro) . . . . . . . . . . . . . 240 --hwmult_type (C-SPY command line option) . . . . . . . . . 262
__setSimBreak (C-SPY system macro) . . . . . . . . . . . . . . 241 --lpt1 (C-SPY command line option) . . . . . . . . . . . . . . . . 263
__setTraceStartBreak (C-SPY system macro). . . . . . . . . . 242 --lpt2 (C-SPY command line option) . . . . . . . . . . . . . . . . 263
__setTraceStopBreak (C-SPY system macro) . . . . . . . . . . 243 --lpt3 (C-SPY command line option) . . . . . . . . . . . . . . . . 263
__smessage (C-SPY macro statement) . . . . . . . . . . . . . . . 216 --macro (C-SPY command line option) . . . . . . . . . . . . . . 263
__sourcePosition (C-SPY system macro) . . . . . . . . . . . . . 244 --mapu (C-SPY command line option) . . . . . . . . . . . . . . . 263
__strFind (C-SPY system macro) . . . . . . . . . . . . . . . . . . . 244 --odd_word_check (C-SPY command line option) . . . . . . 264
__subString (C-SPY system macro) . . . . . . . . . . . . . . . . . 245 --plugin (C-SPY command line option) . . . . . . . . . . . . . . 264
__targetDebuggerVersion (C-SPY system macro) . . . . . . 245 --port (C-SPY command line option) . . . . . . . . . . . . . . . . 265
__toLower (C-SPY system macro) . . . . . . . . . . . . . . . . . . 245 --protocol (C-SPY command line option) . . . . . . . . . . . . . 265
__toString (C-SPY system macro) . . . . . . . . . . . . . . . . . . 246 --settlingtime (C-SPY command line option) . . . . . . . . . . 266
__toUpper (C-SPY system macro) . . . . . . . . . . . . . . . . . . 246 --set_exit_breakpoint (C-SPY command line option) . . . . 266
__unloadImage (C-SPY system macro) . . . . . . . . . . . . . . 247 --set_getchar_breakpoint (C-SPY command line option) . 266
__writeFile (C-SPY system macro) . . . . . . . . . . . . . . . . . 247 --set_putchar_breakpoint (C-SPY command line option) . 266
__writeFileByte (C-SPY system macro) . . . . . . . . . . . . . . 248 --silent (C-SPY command line option) . . . . . . . . . . . . . . . 267
__writeMemoryByte (C-SPY system macro) . . . . . . . . . . 248 --timeout (C-SPY command line option) . . . . . . . . . . . . . 267
UCS430-1
Index
--use_emulated_breakpoints
(C-SPY command line option) . . . . . . . . . . . . . . . . . . . . . 267
--use_virtual_breakpoints (C-SPY command line option). 268
--vccvoltage (C-SPY command line option) . . . . . . . . . . . 268
--verify_all (C-SPY command line option) . . . . . . . . . . . . 268
"Power on" Reset (Emulator menu) . . . . . . . . . . . . . . . . . 285
Numerics
1x Units (Memory window context menu) . . . . . . . . . . . . 125
1x Units (Stack window context menu) . . . . . . . . . . . . . . 134
1x Units (Symbolic Memory window context menu) . . . . 131
2x Units (Memory window context menu) . . . . . . . . . . . . 125
2x Units (Stack window context menu) . . . . . . . . . . . . . . 134
2x Units (Symbolic Memory window context menu) . . . . 131
4x Units (Memory window context menu) . . . . . . . . . . . . 125
4x Units (Stack window context menu) . . . . . . . . . . . . . . 134
4x Units (Symbolic Memory window context menu) . . . . 132
301
UCS430-1