void execute_user_code(void) {
void (*user_code_entry)(void);
unsigned *p;// used for loading address of reset handler from user flash
/* Change the Vector Table to the USER_FLASH_START
in case the user application uses interrupts
According to UM: 5.4 Vector table remapping */
SCB->VTOR = USER_FLASH_START;
// Load contents of second word of user flash - the reset handler address
// in the applications vector table
p = (unsigned *)(USER_FLASH_START + 4);
// Set user_code_entry to be the address contained in that second word
// of user flash
user_code_entry = (void *) *p;
user_code_entry();
} |
MFlash512 (rx) : ORIGIN = 0x10000, LENGTH = 0x70000 /* 512K bytes (alias Flash) */ RamLoc64 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x10000 /* 64K bytes (alias RAM) */ RamPeriph32 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 /* 32K bytes (alias RAM2) */ extSDRAM32768 (rwx) : ORIGIN = 0xa0000000, LENGTH = 0x2000000 /* 32M bytes (alias RAM3) */ |