The most obvious method is to set the watchdog timer in interrupt only mode. In watchdog timer Handler (every 8 seconds):
- you will increment a volatile variable
- reset watchdog timer whenever this variable is less than a constant corresponding to 5 minutes
- when (if) this variable is above the constant, you reset the uc.
In your loop, you set the volatile variable to 0 at each beginning of the loop.