|
|
@ -634,26 +634,30 @@ static void ProcessWriteCommand(void)
|
|
|
|
/* Indicate that the bootloader is terminating */
|
|
|
|
/* Indicate that the bootloader is terminating */
|
|
|
|
WaitForExit = true;
|
|
|
|
WaitForExit = true;
|
|
|
|
|
|
|
|
|
|
|
|
/* Check if empty request data array - an empty request after a filled request retains the
|
|
|
|
/* Check if data supplied for the Start Program command - no data executes the program */
|
|
|
|
previous valid request data, but initializes the reset */
|
|
|
|
if (SentCommand.DataSize)
|
|
|
|
if (!(SentCommand.DataSize))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (SentCommand.Data[1] == 0x00) // Start via watchdog
|
|
|
|
if (SentCommand.Data[1] == 0x01) // Start via jump
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Start the watchdog to reset the AVR once the communications are finalized */
|
|
|
|
|
|
|
|
wdt_enable(WDTO_250MS);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else // Start via jump
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Load in the jump address into the application start address pointer */
|
|
|
|
|
|
|
|
union
|
|
|
|
union
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint8_t Bytes[2];
|
|
|
|
uint8_t Bytes[2];
|
|
|
|
AppPtr_t FuncPtr;
|
|
|
|
AppPtr_t FuncPtr;
|
|
|
|
} Address = {.Bytes = {SentCommand.Data[4], SentCommand.Data[3]}};
|
|
|
|
} Address = {.Bytes = {SentCommand.Data[4], SentCommand.Data[3]}};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Load in the jump address into the application start address pointer */
|
|
|
|
AppStartPtr = Address.FuncPtr;
|
|
|
|
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 */
|
|
|
|
/* Set the flag to terminate the bootloader at next opportunity */
|
|
|
|
RunBootloader = false;
|
|
|
|
RunBootloader = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|