コード例 #1
0
ファイル: sbl_iap.c プロジェクト: bobc/R2C2_Firmware
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 = (USER_FLASH_START & 0x1FFFFF80);

  /* SP (stack pointer) register must be set correctly before jump to the
   *  user application: http://www.keil.com/forum/17342/
   */
  __set_PSP(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;

  // Jump to user application
  user_code_entry();
}
コード例 #2
0
void run_app()
{
	void (*user_code_entry)(void);

	unsigned *p;	// used for loading address of reset handler from user flash

	//NVIC_DeInit();
	//NVIC_SCBDeInit();

	SYSTICK_Cmd(0);
	SYSTICK_IntCmd(0);

	/* Change the Vector Table to the USER_FLASH_START
	in case the user application uses interrupts */
	SCB->VTOR = (FLASH_START_ADDR & 0x1FFFFF80);

	// Load contents of second word of user flash - the reset handler address
	// in the applications vector table
	p = (unsigned *)(FLASH_START_ADDR + 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();

}