Question
Jumping to main program from ISR
Hi,
I try to jump from Bootloader to my main program using this function:
void jumpToMainProgram(){
uint32_t topOfStack = (*(uint32_t *)0x8008200ul);
HAL_RCC_DeInit(); // deinit clocks
// reset all periphals
__HAL_RCC_AHB_FORCE_RESET();
__HAL_RCC_AHB_RELEASE_RESET();
__HAL_RCC_APB1_FORCE_RESET();
__HAL_RCC_APB1_RELEASE_RESET();
__HAL_RCC_APB2_FORCE_RESET();
__HAL_RCC_APB2_RELEASE_RESET();
// reset Systick
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
/*__set_PSP(topOfStack);*/
__set_MSP(topOfStack);
__DSB(); // complete all memory accesses
{
typedef void (*t_pFunctionNoReturn)(void) __attribute__((noreturn));
register t_pFunctionNoReturn pAppl;
register U32 resetHandler;
resetHandler = (U32)0x08008200ul + 4ul;
pAppl = (t_pFunctionNoReturn)(*(U32 *)resetHandler); /* read from Reset vector */
pAppl();
while(1) { } // never reach this point
}
}this works fine normally, but when I call this function from an ISR, the new program does not accept any new interrupts - it seems like the Core thinks I am still in the ISR.
Is there a solution how to jump to another program from an ISR?
thanks,
Michael