diff options
| author | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2010-08-05 09:31:51 +0000 |
|---|---|---|
| committer | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2010-08-05 09:31:51 +0000 |
| commit | cb4474c0df0a1091170857e5708bba6e28e08aa5 (patch) | |
| tree | 05c51b8de8efddb623d5c611f8e32db515a34242 /Bootloaders/DFU/BootloaderDFU.c | |
| parent | 280feb1860f83b32fc88895d7849a761b78b6970 (diff) | |
Fixed software application start command broken in the DFU class bootloader when dfu-programmer is used due to application start address corruption.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1434 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Bootloaders/DFU/BootloaderDFU.c')
| -rw-r--r-- | Bootloaders/DFU/BootloaderDFU.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c index 752c3200..7136b972 100644 --- a/Bootloaders/DFU/BootloaderDFU.c +++ b/Bootloaders/DFU/BootloaderDFU.c @@ -634,26 +634,30 @@ static void ProcessWriteCommand(void) /* Indicate that the bootloader is terminating */ WaitForExit = true; - /* Check if empty request data array - an empty request after a filled request retains the - previous valid request data, but initializes the reset */ - if (!(SentCommand.DataSize)) + /* Check if data supplied for the Start Program command - no data executes the program */ + if (SentCommand.DataSize) { - if (SentCommand.Data[1] == 0x00) // Start via watchdog - { - /* Start the watchdog to reset the AVR once the communications are finalized */ - wdt_enable(WDTO_250MS); - } - else // Start via jump + if (SentCommand.Data[1] == 0x01) // Start via jump { - /* Load in the jump address into the application start address pointer */ union { uint8_t Bytes[2]; AppPtr_t FuncPtr; } Address = {.Bytes = {SentCommand.Data[4], SentCommand.Data[3]}}; + /* Load in the jump address into the application start address pointer */ AppStartPtr = Address.FuncPtr; - + } + } + else + { + if (SentCommand.Data[1] == 0x00) // Start via watchdog + { + /* Start the watchdog to reset the AVR once the communications are finalized */ + wdt_enable(WDTO_250MS); + } + else // Start via jump + { /* Set the flag to terminate the bootloader at next opportunity */ RunBootloader = false; } |
