Advertisement
Guest User

jump to application

a guest
Jan 26th, 2016
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. void jumpApplication() {
  2.     //__disable_irq();
  3.     //__DSB();
  4.     //NVIC_SystemReset();
  5.     /* Pointer to the Application Section */
  6.     void (*application_code_entry)(void);
  7.     /* Rebase the Stack Pointer */
  8.     __set_MSP(*(uint32_t *) APP_START_ADDRESS);
  9.     /* Rebase the vector table base address */
  10.     SCB->VTOR = ((uint32_t) APP_START_ADDRESS & SCB_VTOR_TBLOFF_Msk);
  11.     /* Load the Reset Handler address of the application */
  12.     application_code_entry = (void (*)(void))(unsigned *)(*(unsigned *)(APP_START_ADDRESS + 4));
  13.     /* Jump to user Reset Handler in the application */
  14.     application_code_entry();
  15.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement