Adding McHCK flash reload function and some cleanup.

- Requires special string to be compared with the bootloader and VBAT register file
This commit is contained in:
Jacob Alexander 2014-07-19 09:21:35 -07:00
parent 1fd777815b
commit 8eba0ae354
8 changed files with 31 additions and 28 deletions

View file

@ -682,7 +682,17 @@ void usb_tx(uint32_t endpoint, usb_packet_t *packet)
void usb_device_reload()
{
// MCHCK
#if defined(_mk20dx128vlf5_)
// This line must be exactly the same in the bootloader
const uint8_t sys_reset_to_loader_magic[] = "\xff\x00\x7fRESET TO LOADER\x7f\x00\xff";
for ( int pos = 0; pos < sizeof(sys_reset_to_loader_magic); pos++ )(&VBAT)[pos] = sys_reset_to_loader_magic[ pos ];
SOFTWARE_RESET();
// Teensy 3.0 and 3.1
#else
asm volatile("bkpt");
#endif
}