From: Peter Henn Date: Wed, 29 Dec 2021 14:49:37 +0000 (+0000) Subject: Fix leave Bootloader only in case of valid application code X-Git-Tag: DFU-Bootloader-ProMicro~4 X-Git-Url: http://git.linex4red.de/pub/lufa.git/commitdiff_plain/796b1b50006fc77620a4d1ac642371c6bbb697d5 Fix leave Bootloader only in case of valid application code - Check, if reset vector points to an application before leaving the Bootloader after 5 seconds timeout - Bugfix wrong test of reset vector from mainline --- diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c index f29af3b51..ce76abe29 100644 --- a/Bootloaders/DFU/BootloaderDFU.c +++ b/Bootloaders/DFU/BootloaderDFU.c @@ -237,7 +237,10 @@ int main(void) Delay_MS(1); if (i++ > 5000) { - break; + if (pgm_read_word_near(0) != 0xFFFF) + break; + else + i = 0; } } else @@ -836,7 +839,7 @@ static void ProcessWriteCommand(void) else // Start via jump { /* Set the flag to terminate the bootloader at next opportunity if a valid application has been loaded */ - if (pgm_read_word_near(0) == 0xFFFF) + if (pgm_read_word_near(0) != 0xFFFF) RunBootloader = false; } }