From: Peter Henn Date: Wed, 29 Dec 2021 12:10:53 +0000 (+0000) Subject: Merge tag 'LUFA-170418' into ProMicro X-Git-Tag: DFU-Bootloader-ProMicro~9 X-Git-Url: http://git.linex4red.de/pub/lufa.git/commitdiff_plain/8e881ef48f0f49ed6176404597afea1fc7343165 Merge tag 'LUFA-170418' into ProMicro - use merge strategy "theirs", means in principle rebase ProMicro branch to LUFA-170418 - remove the wrong FUSE_BOOTRST check in Application_Jump_Check which was added in the meantime --- 8e881ef48f0f49ed6176404597afea1fc7343165 diff --cc Bootloaders/DFU/BootloaderDFU.c index 1f86aeea1,8da725d24..8a3538e48 --- a/Bootloaders/DFU/BootloaderDFU.c +++ b/Bootloaders/DFU/BootloaderDFU.c @@@ -121,18 -131,38 +131,27 @@@ void Application_Jump_Check(void /* Re-enable JTAG debugging */ JTAG_ENABLE(); + #else - /* Check if the device's BOOTRST fuse is set */ - if (boot_lock_fuse_bits_get(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)) - 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 - /* 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)) - JumpToApplication |= true; + /* Don't run the user application if the reset vector is blank (no app loaded) */ + bool ApplicationValid = (pgm_read_word_near(0) != 0xFFFF); /* If a request has been made to jump to the user application, honor it */ - if (JumpToApplication) + if (JumpToApplication && ApplicationValid) { /* Turn off the watchdog */ - MCUSR &= ~(1< - #include + //#include + #include + + /* Preprocessor Checks: */ + #if !defined(__OPTIMIZE_SIZE__) + #error This bootloader requires that it be optimized for size, not speed, to fit into the target device. Change optimization settings and try again. + #endif /* Macros: */ /** Major bootloader version number. */ diff --cc LUFA/StudioIntegration/lufa_toolchain.xml index 45a9ba902,66b416e28..dac65df7e --- a/LUFA/StudioIntegration/lufa_toolchain.xml +++ b/LUFA/StudioIntegration/lufa_toolchain.xml @@@ -20,9 -20,10 +20,9 @@@ - + - diff --cc LUFA/StudioIntegration/makefile index 9dee43797,53fb47012..7fa112543 --- a/LUFA/StudioIntegration/makefile +++ b/LUFA/StudioIntegration/makefile @@@ -81,6 -135,8 +135,9 @@@ check_filenames: $(MODULE_OUTPUT_XML fi; \ done || exit 1; \ done; + @echo Verified referenced filenames of ASF.xml modules. - .PHONY: all clean generate_xml generate_vsix check_filenames + check_database: + python ProjectGenerator/project_generator.py -b $(LUFA_ROOT)/../ --main-ext-uuid=0e160d5c-e331-48d9-850b-e0387912171b CHECK + + .PHONY: all clean generate_help generate_xml generate_vsix check_filenames check_database