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 */ SCB->VTOR = (PROGRAM_ADDRESS_START & 0x1FFFFF80); // Load contents of second word of user flash - the reset handler address // in the applications vector table p = (unsigned *)(PROGRAM_ADDRESS_START +4); // Set user_code_entry to be the address contained in that second word // of user flash user_code_entry = (void *) *p; // Jump to user application user_code_entry(); } |
SCB->VTOR = (PROGRAM_ADDRESS_START & 0x1FFFFF80); |