I’m looking for ways to recover a device that is in an incorrect state due to a bug in code, one of the methods I’m trying is to use a buffer overflow and crash the system, then the watchdog would bring the system back running.
But I when I manage to crash the system I see the error messages and the system never resets from the watchdog, I think it is because the message says ‘system will halt after rebooting’.
Is there a way to override this behavior?, that is, the system doesn’t halt.
The example below worked on my mbed LPC1768 as supposed to:
#include "mbed.h"
DigitalOut led(LED1);
Watchdog& watchdog = Watchdog::get_instance();
volatile int i = 0;
volatile int buf[5];
int main()
{
printf("Starting...\r\n");
watchdog.start(20000); // timeout set to 20 s
while (true) {
watchdog.kick();
buf[i++] = i;
led = !led;
printf("blink\r\n");
ThisThread::sleep_for(500);
}
}
It produced the following output on the connected serial terminal: