aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/protocol
diff options
context:
space:
mode:
authorpatrickmt <40182064+patrickmt@users.noreply.github.com>2018-09-28 22:34:56 -0400
committerJack Humbert <jack.humb@gmail.com>2018-09-28 23:09:53 -0400
commitdaf0cc60bff54be948c923cdc40aa80b82a27f6d (patch)
tree121de3f118e7fbc325eb79d23e3dc58c95b99e76 /tmk_core/protocol
parent20a10bd0846d502069203419f57e36fd7467df5e (diff)
downloadqmk_firmware-daf0cc60bff54be948c923cdc40aa80b82a27f6d.tar.gz
qmk_firmware-daf0cc60bff54be948c923cdc40aa80b82a27f6d.zip
CTRL keyboard bootloader_jump support
Adds support for CTRL keyboards to enter bootloader via bootloader_jump()
Diffstat (limited to 'tmk_core/protocol')
-rw-r--r--tmk_core/protocol/arm_atsam/md_bootloader.h7
-rw-r--r--tmk_core/protocol/arm_atsam/startup.c11
2 files changed, 18 insertions, 0 deletions
diff --git a/tmk_core/protocol/arm_atsam/md_bootloader.h b/tmk_core/protocol/arm_atsam/md_bootloader.h
index 1316876c8..956145c31 100644
--- a/tmk_core/protocol/arm_atsam/md_bootloader.h
+++ b/tmk_core/protocol/arm_atsam/md_bootloader.h
@@ -7,6 +7,13 @@ extern uint32_t _erom;
7 7
8#define BOOTLOADER_SERIAL_MAX_SIZE 20 //DO NOT MODIFY! 8#define BOOTLOADER_SERIAL_MAX_SIZE 20 //DO NOT MODIFY!
9 9
10#ifdef KEYBOARD_massdrop_ctrl
11//WARNING: These are only for CTRL bootloader release "v2.18Jun 22 2018 17:28:08" for bootloader_jump support
12extern uint32_t _eram;
13#define BOOTLOADER_MAGIC 0x3B9ACA00
14#define MAGIC_ADDR (uint32_t *)(&_eram - 4)
15#endif
16
10#ifdef MD_BOOTLOADER 17#ifdef MD_BOOTLOADER
11 18
12#define MCU_HZ 48000000 19#define MCU_HZ 48000000
diff --git a/tmk_core/protocol/arm_atsam/startup.c b/tmk_core/protocol/arm_atsam/startup.c
index a62d02f1c..f29fac179 100644
--- a/tmk_core/protocol/arm_atsam/startup.c
+++ b/tmk_core/protocol/arm_atsam/startup.c
@@ -28,6 +28,7 @@
28 */ 28 */
29 29
30#include "samd51.h" 30#include "samd51.h"
31#include "md_bootloader.h"
31 32
32/* Initialize segments */ 33/* Initialize segments */
33extern uint32_t _sfixed; 34extern uint32_t _sfixed;
@@ -500,6 +501,16 @@ const DeviceVectors exception_table = {
500 */ 501 */
501void Reset_Handler(void) 502void Reset_Handler(void)
502{ 503{
504#ifdef KEYBOARD_massdrop_ctrl
505 /* WARNING: This is only for CTRL bootloader release "v2.18Jun 22 2018 17:28:08" for bootloader_jump support */
506 if (*MAGIC_ADDR == BOOTLOADER_MAGIC) {
507 /* At this point, the bootloader's memory is initialized properly, so undo the jump to here, then jump back */
508 *MAGIC_ADDR = 0x00000000; /* Change value to prevent potential bootloader entrance loop */
509 __set_MSP(0x20008818); /* MSP according to bootloader */
510 SCB->VTOR = 0x00000000; /* Vector table back to bootloader's */
511 asm("bx %0"::"r"(0x00001267)); /* Jump past bootloader RCAUSE check using THUMB */
512 }
513#endif
503 uint32_t *pSrc, *pDest; 514 uint32_t *pSrc, *pDest;
504 515
505 /* Initialize the relocate segment */ 516 /* Initialize the relocate segment */