How to breakpoint from sourcecode

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd like to share a technique I've just perfected that allows me to create AVRStudio4 breakpoints in my 'C' source code.

Why is this a helpful technique? Some times your code has a lot of self-checking logic in it and you'd like the debugger to automatically break on an error, ready to be debugged. also, sometimes breakpoints can be lost AVRStudio4 when code changes, requiring you to re-enter all that you need.

Using ICCAVR7:

Put in your macros file or global.h (wherever you have CLI() and SEI() defined:

#define BREAK() asm (".word 0x9598")

To insert a breakpoint in your sourcedode:

BREAK();

unfortunately AVRStudio4 does not mark this breakpoint with a red dot.

Enjoy! Hope his techmique is usefull to you!

DFR

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oopa... Forgot to mention that the break instruction doesn't work on all avrs. I'm using an ATM2560.

To see if your specific processor can use this techniqueue please consult the device specific instruction set summary.

DFR