CTRL keyboard bootloader_jump support

Adds support for CTRL keyboards to enter bootloader via bootloader_jump()
This commit is contained in:
patrickmt
2018-09-28 22:34:56 -04:00
committed by Jack Humbert
parent 20a10bd084
commit daf0cc60bf
4 changed files with 38 additions and 15 deletions

View File

@ -7,6 +7,13 @@ extern uint32_t _erom;
#define BOOTLOADER_SERIAL_MAX_SIZE 20 //DO NOT MODIFY!
#ifdef KEYBOARD_massdrop_ctrl
//WARNING: These are only for CTRL bootloader release "v2.18Jun 22 2018 17:28:08" for bootloader_jump support
extern uint32_t _eram;
#define BOOTLOADER_MAGIC 0x3B9ACA00
#define MAGIC_ADDR (uint32_t *)(&_eram - 4)
#endif
#ifdef MD_BOOTLOADER
#define MCU_HZ 48000000

View File

@ -28,6 +28,7 @@
*/
#include "samd51.h"
#include "md_bootloader.h"
/* Initialize segments */
extern uint32_t _sfixed;
@ -500,6 +501,16 @@ const DeviceVectors exception_table = {
*/
void Reset_Handler(void)
{
#ifdef KEYBOARD_massdrop_ctrl
/* WARNING: This is only for CTRL bootloader release "v2.18Jun 22 2018 17:28:08" for bootloader_jump support */
if (*MAGIC_ADDR == BOOTLOADER_MAGIC) {
/* At this point, the bootloader's memory is initialized properly, so undo the jump to here, then jump back */
*MAGIC_ADDR = 0x00000000; /* Change value to prevent potential bootloader entrance loop */
__set_MSP(0x20008818); /* MSP according to bootloader */
SCB->VTOR = 0x00000000; /* Vector table back to bootloader's */
asm("bx %0"::"r"(0x00001267)); /* Jump past bootloader RCAUSE check using THUMB */
}
#endif
uint32_t *pSrc, *pDest;
/* Initialize the relocate segment */