Created
April 9, 2018 21:22
-
-
Save sidprice/a0bb92305d16e498d12671bc82e50c91 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void (*SysMemBootJump)(void); | |
volatile uint32_t addr = 0x1FFF0000; | |
/* Jump to the built in bootloader by mapping System flash */ | |
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_SYSCFGEN); | |
SYSCFG_MEMRM &= ~3; | |
SYSCFG_MEMRM |= 1; | |
/* | |
set the jump address | |
*/ | |
SysMemBootJump = (void (*)(void)) (*((uint32_t *) (addr + 4))); | |
/* | |
set up the stack for the bootloader | |
*/ | |
asm ("ldr sp, =addr"); | |
/* | |
Jump ... | |
*/ | |
SysMemBootJump (); | |
while ( 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment