]> git.gir.st - tmk_keyboard.git/blob - tmk_core/common/chibios/bootloader.c
Implement jump-to-bootloader.
[tmk_keyboard.git] / tmk_core / common / chibios / bootloader.c
1 #include "bootloader.h"
2
3 #include "ch.h"
4
5 #ifdef BOOTLOADER_ADDRESS
6 #define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
7 extern uint32_t __ram0_end__;
8
9 void bootloader_jump(void) {
10 *((unsigned long *)(SYMVAL(__ram0_end__) - 4)) = 0xDEADBEEF; // set magic flag => reset handler will jump into boot loader
11 NVIC_SystemReset();
12 }
13 #else /* BOOTLOADER_ADDRESS */
14 void bootloader_jump(void) {}
15 #endif /* BOOTLOADER_ADDRESS */
16
Imprint / Impressum