diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2014-10-12 16:43:30 +1100 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2014-10-12 16:43:30 +1100 |
commit | a09cb7e3d8d6256f5610459ee8dd80e0efd741f7 (patch) | |
tree | fd87b7ee781ca797d3ce26085c5e05ad4f7c38da /Bootloaders/CDC | |
parent | 4c637c93ba69e33c77034eef9bd4433252e139fc (diff) | |
download | lufa-a09cb7e3d8d6256f5610459ee8dd80e0efd741f7.tar.gz lufa-a09cb7e3d8d6256f5610459ee8dd80e0efd741f7.tar.bz2 lufa-a09cb7e3d8d6256f5610459ee8dd80e0efd741f7.zip |
Fix bootloaders not starting user application if the HWB is grounded during watchdog reset.
Diffstat (limited to 'Bootloaders/CDC')
-rw-r--r-- | Bootloaders/CDC/BootloaderCDC.c | 11 | ||||
-rw-r--r-- | Bootloaders/CDC/BootloaderCDC.txt | 20 |
2 files changed, 13 insertions, 18 deletions
diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index 1f076530d..63991de75 100644 --- a/Bootloaders/CDC/BootloaderCDC.c +++ b/Bootloaders/CDC/BootloaderCDC.c @@ -103,8 +103,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) */ diff --git a/Bootloaders/CDC/BootloaderCDC.txt b/Bootloaders/CDC/BootloaderCDC.txt index 5f24a16e5..f8c349cde 100644 --- a/Bootloaders/CDC/BootloaderCDC.txt +++ b/Bootloaders/CDC/BootloaderCDC.txt @@ -64,9 +64,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). @@ -81,16 +81,6 @@ * Ground \c IO13 when powering the board to start the bootloader. This assumes the \c HWBE fuse is cleared and the * \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board. * - * For board specific exceptions to the above, see below. - * - * \subsection SSec_XPLAIN Atmel Xplain Board - * Ground the USB AVR JTAG's \c TCK pin to ground when powering on the board to start the bootloader. This assumes the - * \c HWBE fuse is cleared and the \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board. - * - * \subsection SSec_Leonardo Arduino Leonardo Board - * Ground \c IO13 when powering the board to start the bootloader. This assumes the \c HWBE fuse is cleared and the - * \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board. - * * \section Sec_Installation Driver Installation * * After running this bootloader for the first time on a new computer, you will need to supply the .INF @@ -214,12 +204,6 @@ * access. * See <a href=https://groups.google.com/d/msg/lufa-support/CP9cy2bc8yo/kBqsOu-RBeMJ>here</a> for resolution steps. * - * \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. |