Implement jump-to-bootloader.
This commit is contained in:
parent
8152d279a4
commit
d057e5157e
3 changed files with 131 additions and 3 deletions
|
|
@ -1,7 +1,16 @@
|
|||
/* TODO */
|
||||
/* ... chip dependent ... */
|
||||
|
||||
#include "bootloader.h"
|
||||
|
||||
#include "ch.h"
|
||||
|
||||
#ifdef BOOTLOADER_ADDRESS
|
||||
#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
|
||||
extern uint32_t __ram0_end__;
|
||||
|
||||
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 */
|
||||
void bootloader_jump(void) {}
|
||||
#endif /* BOOTLOADER_ADDRESS */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue