LPC15xx bootloader

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC15xx bootloader

1,121 Views
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);
}

Labels (1)
0 Kudos
Reply
1 Reply

881 Views
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 Kudos
Reply