Skip to content

Instantly share code, notes, and snippets.

@Harakan
Created February 2, 2016 21:14
Show Gist options
  • Save Harakan/659edd951cd9f6e65dec to your computer and use it in GitHub Desktop.
Save Harakan/659edd951cd9f6e65dec to your computer and use it in GitHub Desktop.
is that a staticly defined function by function address?
#define BOOTLOADER_START_ADDR 0x1fffc400 //This may be c800
static uint32_t *bootloader_msp = (void *)BOOTLOADER_START_ADDR;
static void *(**bootloader)() = (void *)BOOTLOADER_START_ADDR + 4;
__set__MSP(*bootloader_msp); //set the stack pointer to the addr
(*bootloader)(); //Execute program at location bootloader
@Harakan
Copy link
Author

Harakan commented Feb 2, 2016

//Better demo, with an actual function where it should be

define BOOTLOADER_START_ADDR 0x1fffc400 //This may be c800

static uint32_t bootloader_msp = (void *)BOOTLOADER_START_ADDR;
static void *(
*bootloader)() = (void *)BOOTLOADER_START_ADDR + 4;

void jump_to_bootloader_addr(){
__set__MSP(_bootloader_msp); //set the stack pointer to the addr
(_bootloader)(); //Execute program at location bootloader
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment