Commit 1e9148db authored by Dean Camera's avatar Dean Camera
Browse files

Fix bootloaders incorrectly checking the BOOTRST fuse on start (thanks to Braden Kell).

parent 0a5848ef
...@@ -97,7 +97,7 @@ void Application_Jump_Check(void) ...@@ -97,7 +97,7 @@ void Application_Jump_Check(void)
JTAG_ENABLE(); JTAG_ENABLE();
#else #else
/* Check if the device's BOOTRST fuse is set */ /* Check if the device's BOOTRST fuse is set */
if (BootloaderAPI_ReadFuse(GET_HIGH_FUSE_BITS) & FUSE_BOOTRST) if (!(BootloaderAPI_ReadFuse(GET_HIGH_FUSE_BITS) & ~FUSE_BOOTRST))
{ {
/* If the reset source was not an external reset or the key is correct, clear it and jump to the application */ /* If the reset source was not an external reset or the key is correct, clear it and jump to the application */
if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY)) if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
......
...@@ -133,7 +133,7 @@ void Application_Jump_Check(void) ...@@ -133,7 +133,7 @@ void Application_Jump_Check(void)
JTAG_ENABLE(); JTAG_ENABLE();
#else #else
/* Check if the device's BOOTRST fuse is set */ /* Check if the device's BOOTRST fuse is set */
if (BootloaderAPI_ReadFuse(GET_HIGH_FUSE_BITS) & FUSE_BOOTRST) if (!(BootloaderAPI_ReadFuse(GET_HIGH_FUSE_BITS) & ~FUSE_BOOTRST))
{ {
/* If the reset source was not an external reset or the key is correct, clear it and jump to the application */ /* If the reset source was not an external reset or the key is correct, clear it and jump to the application */
if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY)) if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
......
...@@ -114,7 +114,7 @@ void Application_Jump_Check(void) ...@@ -114,7 +114,7 @@ void Application_Jump_Check(void)
JTAG_ENABLE(); JTAG_ENABLE();
#else #else
/* Check if the device's BOOTRST fuse is set */ /* Check if the device's BOOTRST fuse is set */
if (BootloaderAPI_ReadFuse(GET_HIGH_FUSE_BITS) & FUSE_BOOTRST) if (!(BootloaderAPI_ReadFuse(GET_HIGH_FUSE_BITS) & ~FUSE_BOOTRST))
{ {
/* If the reset source was not an external reset or the key is correct, clear it and jump to the application */ /* If the reset source was not an external reset or the key is correct, clear it and jump to the application */
if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY)) if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
......
...@@ -146,7 +146,7 @@ void Application_Jump_Check(void) ...@@ -146,7 +146,7 @@ void Application_Jump_Check(void)
JTAG_ENABLE(); JTAG_ENABLE();
#else #else
/* Check if the device's BOOTRST fuse is set */ /* Check if the device's BOOTRST fuse is set */
if (BootloaderAPI_ReadFuse(GET_HIGH_FUSE_BITS) & FUSE_BOOTRST) if (!(BootloaderAPI_ReadFuse(GET_HIGH_FUSE_BITS) & ~FUSE_BOOTRST))
{ {
/* If the reset source was not an external reset or the key is correct, clear it and jump to the application */ /* If the reset source was not an external reset or the key is correct, clear it and jump to the application */
if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY)) if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* - Library Applications: * - Library Applications:
* - Fixed bootloaders not disabling global interrupts during erase and write operations (thanks to Zoltan) * - Fixed bootloaders not disabling global interrupts during erase and write operations (thanks to Zoltan)
* - Fixed bootloaders accepting flash writes to the bootloader region (thanks to NicoHood) * - Fixed bootloaders accepting flash writes to the bootloader region (thanks to NicoHood)
* - Fixed bootloaders incorrectly checking the BOOTRST fuse on start (thanks to Braden Kell)
* *
* \section Sec_ChangeLog170418 Version 170418 * \section Sec_ChangeLog170418 Version 170418
* <b>New:</b> * <b>New:</b>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment