LPC15xx bootloader

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC15xx bootloader

1,123 次查看
sveer9211
Contributor I

I have written a bootloader code which have to jump to the  Application code reside at the address 0x20000 .but boot code not able to jump to desired location . i have used the code to jump is  :  

pFunction  = function pointer;

*******************************************************************************/
void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset)
{
__disable_irq();
SCB->VTOR = NVIC_VectTab | (Offset & 0x1FFFFF80);
__enable_irq();
}


/*** Jump to application ******************************************************/
void JumpToAddress(uint32_t Address)
{
uint32_t JumpAddress = *(__IO uint32_t*)(Address + 4);
pFunction Jump = (pFunction)JumpAddress;

NVIC_SetVectorTable(0x00000000 , Address);
__set_MSP(*(__IO uint32_t*) Address);
Jump();
while(1);
}

标签 (1)
0 项奖励
回复
1 回复

883 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Lakhbir Singh,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
Please give below code a try.

typedef  void (*pFunction)(void);
pFunction Jump_To_Application;
static uint32_t JumpAddress;


void run_to_app(void)
{
          JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);

          /* Jump to user application */
          Jump_To_Application = (pFunction) JumpAddress;
          /* Initialize user application's S4tack Pointer */
          __set_MSP(*(__IO uint32_t*) ApplicationAddress);
          SCB->VTOR  = ApplicationAddress & 0x1FFFFF80;
          Jump_To_Application();
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复