Hi Dawid,
Please use this code to jump to bootloader from main application:
__asm void loadPC(int Addr)
{
LDR sp, [r0, #0] ; Get app stack pointer
LDR r1, [r0, #4] ; Get app reset vector
CPSIE I ; Enable ints at core
BX r1
}
void houseClean(void)
{
LPC_SYSCON->MAINCLKSEL = 0; //Internal oscillator
}
void executeBootloader(void)
{
houseClean();
__disable_irq();
SCB->VTOR = (unsigned int) 0x0000;
loadPC(0x0000);
}
When you want to jump to the bootloader, call executeBootloader() function.
If you want to reset SPI interface, please call Chip_SSP_DeInit function before you jump to bootloader.
Wish it helps you!
If you still have question, please let me know!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------