Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1.    
  2.     /* Test if user code is programmed starting from address "program_address" */
  3.     if (
  4.         ((*(__IO uint32_t *) FlashAddress) & 0x2FFE0000) == 0x20000000 && /*!< Program is loaded */
  5.         TM_FLASHLOADER_BeforeJump(FlashAddress)                           /*<! Jump is allowed to location */
  6.     ) {
  7.         /* Disable interrupts */
  8.         __disable_irq();
  9.        
  10.         /* Set FLASH vector table */
  11.         SCB->VTOR = 0x08000000 | (FlashAddress & (uint32_t)0x1FFFFF80);
  12.        
  13.         /* Jump to user application, set jump address */
  14.         Jump_To_Application = (Bootloader_Function) *(__IO uint32_t *) (FlashAddress + 4);
  15.        
  16.         /* Initialize user application's Stack Pointer */
  17.         __set_MSP(*(__IO uint32_t *) FlashAddress);
  18.        
  19.         /* Jump to application */
  20.         Jump_To_Application();
  21.        
  22.         /* Return 1 = This should never happen */
  23.         return 1;
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement