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:
parent
1fd777815b
commit
8eba0ae354
8 changed files with 31 additions and 28 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* Teensyduino Core Library
|
||||
* http://www.pjrc.com/teensy/
|
||||
* Copyright (c) 2013 PJRC.COM, LLC.
|
||||
* Modifications by Jacob Alexander 2014
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
|
@ -39,14 +40,19 @@
|
|||
#include "usb_mem.h"
|
||||
#include "usb_desc.h"
|
||||
|
||||
void usb_init();
|
||||
#define usb_device_software_reset() SOFTWARE_RESET()
|
||||
|
||||
uint8_t usb_configured(); // is the USB port configured
|
||||
|
||||
void usb_init();
|
||||
void usb_isr();
|
||||
usb_packet_t *usb_rx(uint32_t endpoint);
|
||||
uint32_t usb_tx_byte_count(uint32_t endpoint);
|
||||
uint32_t usb_tx_packet_count(uint32_t endpoint);
|
||||
void usb_tx(uint32_t endpoint, usb_packet_t *packet);
|
||||
void usb_tx_isr(uint32_t endpoint, usb_packet_t *packet);
|
||||
void usb_tx( uint32_t endpoint, usb_packet_t *packet );
|
||||
void usb_tx_isr( uint32_t endpoint, usb_packet_t *packet );
|
||||
|
||||
uint32_t usb_tx_byte_count( uint32_t endpoint );
|
||||
uint32_t usb_tx_packet_count( uint32_t endpoint );
|
||||
|
||||
usb_packet_t *usb_rx( uint32_t endpoint );
|
||||
|
||||
void usb_device_reload();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue