2021-12-22 10:28 PM
One of our project has problem, not easy to find, because of nonregularity of occuring in unknow part of code (it hasnt been reproduced in controlled way). I would like to write macro, that will replace every call of problematic part of code (which is called in a lot of different places in code) by additional if() statement, that will prevent from doing unallowed things by writing through console name of file and number of line in case of error and halt the processor (I dont want to keep running this program after error). How can I stop executing program?
Or maybe there is anothere way to do something like this?
Regards,
2021-12-22 10:35 PM
How helps halt? Why no debug breakpoint on if?
2021-12-23 01:48 AM
Tracing is another way to tackle that problem.
2021-12-23 04:57 AM
A breakpoint instruction would stop in the debugger, or generate a Hard Fault without one, stopping in the while() loop their blocking execution and interrupts.
2021-12-23 07:31 AM
while (1); will also keep the processor busy forever. Disabling interrupts, resetting DMA, timers, other peripherals may also be wise depending on your program and needs.
2021-12-23 09:52 AM
STM32Cube_FW_F7_V1.16.0\Drivers\CMSIS\Core\Include\cmsis_gcc.h
/**
\brief Breakpoint
\details Causes the processor to enter Debug state.
Debug tools can use this to investigate system state when the instruction at a particular address is reached.
\param [in] value is ignored by the processor.
If required, a debugger can use it to store additional information about the breakpoint.
*/
#define __BKPT(value) __ASM volatile ("bkpt "#value)