How to stop executing program/halt the CPU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-22 10:35 PM
How helps halt? Why no debug breakpoint on if?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-23 1:48 AM
Tracing is another way to tackle that problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-23 4: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.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-23 7: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-23 9: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)
Up vote any posts that you find helpful, it shows what's working..
