I did exactly this about 8 years ago. I believe I just looked up the Watchdog registers in the manual for the CPU and set a few of the bits using that LowLevel API. Then in my program’s main loop or in a separate thread with a loop, I would set the keep alive bit. If my program ever froze, the keep alive bit would not get set and the whole thing would reboot. I can’t find that code anymore, but here is an old post: