Nice trick to debug STM32 (and most cortex M cores): improved assert
Something wrong with asserts is that you dont really know what to do with them.
Print something, store stuff somewhere, put a breakpoint on it
The problem with embedded debuggers is that the number of hardware breakpoints is small (~4 or so), so putting one there will consume one of those precious few.
Or you could add
__asm__ ("bkpt 1");
To your assert function.
That will stop the debugger without consuming a breakpoint.
Print something, store stuff somewhere, put a breakpoint on it
The problem with embedded debuggers is that the number of hardware breakpoints is small (~4 or so), so putting one there will consume one of those precious few.
Or you could add
__asm__ ("bkpt 1");
To your assert function.
That will stop the debugger without consuming a breakpoint.
Comments
Post a Comment