Fix bootloaders incorrectly checking the BOOTRST fuse on start (thanks to Braden...
authorDean Camera <dean@fourwalledcubicle.com>
Mon, 2 Apr 2018 04:51:18 +0000 (14:51 +1000)
committerDean Camera <dean@fourwalledcubicle.com>
Mon, 2 Apr 2018 04:51:22 +0000 (14:51 +1000)
Bootloaders/CDC/BootloaderCDC.c
Bootloaders/DFU/BootloaderDFU.c
Bootloaders/MassStorage/BootloaderMassStorage.c
Bootloaders/Printer/BootloaderPrinter.c
LUFA/DoxygenPages/ChangeLog.txt

index bcb5c85..00755a5 100644 (file)
@@ -97,7 +97,7 @@ void Application_Jump_Check(void)
                JTAG_ENABLE();
        #else
                /* Check if the device's BOOTRST fuse is set */
                JTAG_ENABLE();
        #else
                /* 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 (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
                {
                        /* 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))
index cafbd57..3167c89 100644 (file)
@@ -133,7 +133,7 @@ void Application_Jump_Check(void)
                JTAG_ENABLE();
        #else
                /* Check if the device's BOOTRST fuse is set */
                JTAG_ENABLE();
        #else
                /* 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 (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
                {
                        /* 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))
index 81a8dc4..ca3fd28 100644 (file)
@@ -114,7 +114,7 @@ void Application_Jump_Check(void)
                JTAG_ENABLE();
        #else
                /* Check if the device's BOOTRST fuse is set */
                JTAG_ENABLE();
        #else
                /* 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 (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
                {
                        /* 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))
index da41621..629cc07 100644 (file)
@@ -146,7 +146,7 @@ void Application_Jump_Check(void)
                JTAG_ENABLE();
        #else
                /* Check if the device's BOOTRST fuse is set */
                JTAG_ENABLE();
        #else
                /* 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 (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
                {
                        /* 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))
index 5474406..719ae22 100644 (file)
@@ -21,6 +21,7 @@
   *  - Library Applications:
   *   - 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)
   *  - Library Applications:
   *   - 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 incorrectly checking the BOOTRST fuse on start (thanks to Braden Kell)
   *
   *  \section Sec_ChangeLog170418 Version 170418
   *  <b>New:</b>
   *
   *  \section Sec_ChangeLog170418 Version 170418
   *  <b>New:</b>