aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bootloaders/CDC/BootloaderCDC.c6
-rw-r--r--Bootloaders/DFU/BootloaderDFU.c11
2 files changed, 15 insertions, 2 deletions
diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c
index 211b054e3..7bff89994 100644
--- a/Bootloaders/CDC/BootloaderCDC.c
+++ b/Bootloaders/CDC/BootloaderCDC.c
@@ -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)();
}
diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c
index 233e145ae..528e8cb0c 100644
--- a/Bootloaders/DFU/BootloaderDFU.c
+++ b/Bootloaders/DFU/BootloaderDFU.c
@@ -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)();
}
}