Commit 615d34f1 authored by Dean Camera's avatar Dean Camera
Browse files

Turn off watchdog before jumping to the user application in the DFU and CDC...

Turn off watchdog before jumping to the user application in the DFU and CDC based bootloaders, for the specific case of /HWB being low during reset (where the bootloader will re-enter).
parent 5833b27f
......@@ -73,7 +73,13 @@ void Application_Jump_Check(void)
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application */
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
{
/* Turn off the watchdog */
MCUSR &= ~(1<<WDRF);
wdt_disable();
/* Clear the boot key and jump to the user application */
MagicBootKey = 0;
// cppcheck-suppress constStatement
((void (*)(void))0x0000)();
}
......
......@@ -106,11 +106,18 @@ uint32_t MagicBootKey ATTR_NO_INIT;
*/
void Application_Jump_Check(void)
{
// If the reset source was the bootloader and the key is correct, clear it and jump to the application
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application */
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
{
/* Turn off the watchdog */
MCUSR &= ~(1<<WDRF);
wdt_disable();
/* Clear the boot key and jump to the user application */
MagicBootKey = 0;
AppStartPtr();
// cppcheck-suppress constStatement
((void (*)(void))0x0000)();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment