Thanks, I found that solution too. I Just don't care about the restart anymore because seldom have program that need to go up to ending and instead going in infinity loop after few setting of main
Any microprocessor/mcu/cpu is always doing something. From the moment of power up, it will be executing instructions given to it
even if the instructions results in doing nothing useful. To stop the CPU, you basically can power down, or to stop the CPU clock from ticking.
If it is a multi-processing/multi-treaded systems, one can say: this thread you are doing for me has nothing left to do, so terminate me. The CPU terminates that thread and go do other active things - if such other active threads exists. For a single-tasking system, when your main() is done, it got nothing to do other than looping waiting for an interrupt to occur in which case it would still be not doing anything of interest as you have no further instructions for it.
With typical MCU being single tasking, once you have no further instructions for it to do, it is done. Empty loop, or loop forever to blick an LED, or HALT doesn't really matter. If your hardware doesn't have a software triggerable power off, it will just have to bore itself to death.
One can of course implement a power save state or sleep state to save power. But it adds cost and judging from its availability on typical MCU broads, apparently there is not enough of a market for it.