Breakpoints in C-SPY for AVR
Technical Note 88367
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.
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" 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.
When the PC is equal to a certain address the chip will stop.
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.