2015-09-07 20:57:04 +00:00
|
|
|
#include "bootloader.h"
|
|
|
|
|
2015-09-08 15:07:34 +00:00
|
|
|
#include "ch.h"
|
|
|
|
|
|
|
|
#ifdef BOOTLOADER_ADDRESS
|
|
|
|
#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
|
|
|
|
extern uint32_t __ram0_end__;
|
2015-09-07 20:57:04 +00:00
|
|
|
|
2015-09-08 15:07:34 +00:00
|
|
|
void bootloader_jump(void) {
|
|
|
|
*((unsigned long *)(SYMVAL(__ram0_end__) - 4)) = 0xDEADBEEF; // set magic flag => reset handler will jump into boot loader
|
|
|
|
NVIC_SystemReset();
|
|
|
|
}
|
|
|
|
#else /* BOOTLOADER_ADDRESS */
|
2015-09-07 20:57:04 +00:00
|
|
|
void bootloader_jump(void) {}
|
2015-09-08 15:07:34 +00:00
|
|
|
#endif /* BOOTLOADER_ADDRESS */
|
|
|
|
|