diff options
author | patrickmt <40182064+patrickmt@users.noreply.github.com> | 2018-09-28 22:34:56 -0400 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-09-28 23:09:53 -0400 |
commit | daf0cc60bff54be948c923cdc40aa80b82a27f6d (patch) | |
tree | 121de3f118e7fbc325eb79d23e3dc58c95b99e76 /tmk_core/protocol/arm_atsam/startup.c | |
parent | 20a10bd0846d502069203419f57e36fd7467df5e (diff) |
CTRL keyboard bootloader_jump support
Adds support for CTRL keyboards to enter bootloader via bootloader_jump()
Diffstat (limited to 'tmk_core/protocol/arm_atsam/startup.c')
-rw-r--r-- | tmk_core/protocol/arm_atsam/startup.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tmk_core/protocol/arm_atsam/startup.c b/tmk_core/protocol/arm_atsam/startup.c index a62d02f1ca..f29fac179b 100644 --- a/tmk_core/protocol/arm_atsam/startup.c +++ b/tmk_core/protocol/arm_atsam/startup.c @@ -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 */ |