Breakpoints in C-SPY for AVR

Technical Note 88367

Targets:
AVR

Component:
Debugger

Updated:
4/13/2011 2:51 PM

Introduction

There are different types of breakpoints in C-SPY that work differently. This Technical Note applies to IAR Embedded Workbench for AVR.

How are the breakpoints set?

Breakpoints are used by C-SPY to control the code execution.

Temporary breakpoints

When stepping in C or Assembler code, a number of temporary breakpoints are set (for all possible branches):

  • With “straight” code only one breakpoint is set, C-SPY will run then stop at the next statement.
  • An if statement gives two possible branches that require two breakpoints.
  • A function call requires one breakpoint. The placement depends on if “step-over” or “step in” is used.
  • Switch statement usually requires a number of breakpoints.

Fixed breakpoints

"Fixed breakpoints" are those set by the user or those set by C-SPY at certain fixed locations, CLIB getchar / putchar / exit, DLIB debugbreak (depending on project settings Options > Linker > Output > Format: With runtime control modules).

Are there variants of breakpoints when debugging on hardware?

When using hardware debugging (that is, not using the Simulator) there are two breakpoint variants: Hardware breakpoints and Software breakpoints.

Hardware Breakpoints

When the PC is equal to a certain address the chip will stop.

Software Breakpoints

A "break" instruction is set in the program.

There are a limited number of hardware breakpoints. Software breakpoints are only limited by the code memory size, but they are more expensive, as they can wear out the flash memory.

How are breakpoints used in XMEGA devices?

In Atmel XMEGA devices, there are usually very few hardware breakpoints available. Primarily they are used as "temporary breakpoints". When all the hardware breakpoints are used up, software breakpoints will be used.

 

All product names are trademarks or registered trademarks of their respective owners.

Related Tech Notes

© IAR Systems 1995-2016 - All rights reserved.