diff options
Diffstat (limited to 'Bootloaders/MassStorage/BootloaderMassStorage.c')
-rw-r--r-- | Bootloaders/MassStorage/BootloaderMassStorage.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Bootloaders/MassStorage/BootloaderMassStorage.c b/Bootloaders/MassStorage/BootloaderMassStorage.c index afbc25014..2765e2c20 100644 --- a/Bootloaders/MassStorage/BootloaderMassStorage.c +++ b/Bootloaders/MassStorage/BootloaderMassStorage.c @@ -120,8 +120,19 @@ void Application_Jump_Check(void) if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY)) JumpToApplication = true; + /* Clear reset source */ MCUSR &= ~(1 << EXTRF); } + else + { + /* If the reset source was the bootloader and the key is correct, clear it and jump to the application; + * this can happen in the HWBE fuse is set, and the HBE pin is low during the watchdog reset */ + if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY)) + JumpToApplication = true; + + /* Clear reset source */ + MCUSR &= ~(1 << WDRF); + } #endif /* Don't run the user application if the reset vector is blank (no app loaded) */ |