LPC15xx bootloader

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC15xx bootloader

1,125件の閲覧回数
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 返信

885件の閲覧回数
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 件の賞賛
返信