X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/0b95817130e3c3e0f859c160210d6184fc642fdb..f0c5dfe8b8f47211f03454da036223d65e08249c:/Bootloaders/HID/BootloaderHID.c diff --git a/Bootloaders/HID/BootloaderHID.c b/Bootloaders/HID/BootloaderHID.c index 04fd0df3b..ec094b1d0 100644 --- a/Bootloaders/HID/BootloaderHID.c +++ b/Bootloaders/HID/BootloaderHID.c @@ -58,6 +58,11 @@ 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 @@ -98,6 +103,9 @@ static void SetupHardware(void) MCUSR &= ~(1 << WDRF); wdt_disable(); + /* Disable clock division */ + clock_prescale_set(clock_div_1); + /* Relocate the interrupt vector table to the bootloader section */ MCUCR = (1 << IVCE); MCUCR = (1 << IVSEL); @@ -153,7 +161,7 @@ void EVENT_USB_Device_ControlRequest(void) { RunBootloader = false; } - else + else if (PageAddress < BOOT_START_ADDR) { /* Erase the given FLASH page, ready to be programmed */ boot_page_erase(PageAddress);