Fix bootloaders not starting user application if the HWB is grounded during watchdog reset.
This commit is contained in:
@@ -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) */
|
||||
|
||||
@@ -67,9 +67,9 @@
|
||||
*
|
||||
* The are two behaviours of this bootloader, depending on the device's fuses:
|
||||
*
|
||||
* <b>If the device's BOOTRST fuse is set</b>, the bootloader will run any time the system is not reset from
|
||||
* <b>If the device's BOOTRST fuse is set</b>, the bootloader will run any time the system is reset from
|
||||
* the external reset pin, unless no valid user application has been loaded. To initiate the bootloader, the
|
||||
* device's external reset pin should be grounded.
|
||||
* device's external reset pin should be grounded momentarily.
|
||||
*
|
||||
* <b>If the device's BOOTRST fuse is not set</b>, the bootloader will run only if initiated via a software
|
||||
* jump, or if the \c HWB pin was low during the last device reset (if the \c HWBE fuse is set).
|
||||
@@ -206,12 +206,6 @@
|
||||
* Mass Storage bootloader, or the file system synced via an appropriate command
|
||||
* (such as the OS's normal disk ejection command) before disconnecting the device.
|
||||
*
|
||||
* \par After loading an application, it is not run automatically on startup.
|
||||
* Some USB AVR boards ship with the BOOTRST fuse set, causing the bootloader
|
||||
* to run automatically when the device is reset. In most cases, the BOOTRST
|
||||
* fuse should be disabled and the HWBE fuse used instead to run the bootloader
|
||||
* when needed.
|
||||
*
|
||||
* \section Sec_Options Project Options
|
||||
*
|
||||
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
|
||||
|
||||
Reference in New Issue
Block a user