Thursday, February 26, 2009

Software Breakpoints

in the IAR Kickstart Edition for ARM you can set Software Breakpoints only in RAM code. For Software Breakpoints in Flash you have to buy an additional licence from Segger.
But you can define a Breakpoint instruction and insert it into assertions:


/* this is only for THUMB code */
#define BREAK() __asm(" dc16 0xdeee")
#define ASSERT(x) if (!(x)) then BREAK();

void some_function(char *data)
{
ASSERT(data != NULL);
.
.
.
}


The gnu GDB uses 0xbebe as software Breakpoint for thumb code.