Hi
can i halt the cpu when i am at end of code? like this:
#endif (void)WDT1_Service(); __asm("WFI"); // Enable Debugging CoreDebug->DHCSR |= CoreDebug_DHCSR_C_DEBUGEN_Msk; // Halt the processor CoreDebug->DHCSR |= CoreDebug_DHCSR_C_HALT_Msk; for (;;) { } }
While that might be possible, it's quite unlikely to be useful. You're programming an embedded device here ... "end of application" for those usally means that the device will be thrown away.
The key question then becomes: assuming that you've done the above, will the device never be needed again? Of if it will be needed again, how do you plan on getting it back out of this halted state?
Yes application that is intended for one-time use. In the event that I need to reuse it, I can simply reprogram it. To facilitate this, I am seeking a method to halt the CPU once the application reaches its conclusion.
The reason behind this requirement is that I have developed a software tool to debug the device, and it is essential for me to determine when a application has finished execution. As it stands, the application continues to run indefinitely, making it difficult for me to ascertain its completion status.
ThanksMario
That seems a very strange approach to deducing that information. Your device doing nothing at all would still have two possible causes: it shut itself down on purpose, or it's completely hosed. In short, absence of reaction is very rarely a good way to signal anything.
Are you describing semihosting? The default implementation of _sys_exit will stop on a breakpoint (HLT).