mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
save RAM content overridden by bootloader magic
and restore it in case of aborted reboot use RAMEND-1 as suggested by @yyyc514 in PR #2474 of course it's not a real solution but we cannot force everyone to update the bootloader using an external programmer
This commit is contained in:
parent
5defaeaa97
commit
8a45883230
@ -95,6 +95,7 @@ bool CDC_Setup(USBSetup& setup)
|
||||
// We check DTR state to determine if host port is open (bit 0 of lineState).
|
||||
if (1200 == _usbLineInfo.dwDTERate && (_usbLineInfo.lineState & 0x01) == 0)
|
||||
{
|
||||
*(uint16_t *)(RAMEND-1) = *(uint16_t *)0x0800;
|
||||
*(uint16_t *)0x0800 = 0x7777;
|
||||
wdt_enable(WDTO_120MS);
|
||||
}
|
||||
@ -107,7 +108,7 @@ bool CDC_Setup(USBSetup& setup)
|
||||
|
||||
wdt_disable();
|
||||
wdt_reset();
|
||||
*(uint16_t *)0x0800 = 0x0;
|
||||
*(uint16_t *)0x0800 = *(uint16_t *)(RAMEND-1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user