I'm successfully jump from bootloader to application and application to bootloader.
Please note I'm not using watchdog in my bootloader.
When I'm enable watchdog in application it successfully jumps to bootloader but it reset after watchdog timeout. when I'm disable (not initialize) watchdog then it works.
Application to bootloader jump Code:
WWDT_Deinit(WWDT);
POWER_DisablePD(kPDRUNCFG_PD_WDT_OSC);
NVIC_DisableIRQ(WDT_IRQn);
while(xUART[0].u1TxOnGoing); // wait till UART send all bytes
FirmwareUtility_Boot(0x3000);
void FirmwareUtility_Boot(U32 u32Address)
{
/* Ref: https://community.nxp.com/thread/494497 */
typedef void (*APPLICATION)(void);
APPLICATION xEntryPoint;
// Clear all interrupts and disable before vector reallocate
_ClearDisableAllIRQ();
/* Disable SysTick timer */
SysTick->CTRL &= ~(SysTick_CTRL_TICKINT_Msk | SysTick_CTRL_ENABLE_Msk);
// Vector reallocate
__DSB();
__ISB();
__set_MSP(*((U32 *)u32Address));
SCB->VTOR = (u32Address & SCB_VTOR_TBLOFF_Msk);
__DSB();
__ISB();
xEntryPoint = (APPLICATION) *((U32 *)(u32Address + 4));
_DisablePLL();
xEntryPoint();
}