Issue with STM32F107 bootloader. The jump to application fails
Hi, I have got an issue with STM32F107 bootloader. The jump to application fails and results in hardfault. Before jumping, I have disabled all interrupts including systick timer and also set the MSP to the initial value as needed for the application program. Is there anything else to be taken care of, before making the jump? Could someone help? I have just copied the relevant part of my code below.
/********************************* declarations and defines ****************************/
unsigned *p;
void (*user_code_entry)(void);
unsigned int Address_PgrmCounter;
#define APPLICATIONADDRESS (unsigned int)0x800e000
/********************************* reset system and disable all interrupts****************/
HAL_RCC_DeInit();
HAL_DeInit(); SysTick->CTRL &= ~0x00000011; /* Disable systick counter*/ __HAL_RCC_TIM2_CLK_DISABLE();__disable_irq();
for(i=0;i<68;i++)
{ HAL_NVIC_DisableIRQ(i); } for(i=0;i<=15;i++) { __HAL_GPIO_EXTI_CLEAR_IT(i); }SCB->ICSR &= ~(0x10000000) ;
/********************************* set MSP **********************************************/
__set_MSP(APPLICATIONADDRESS);
/********************************* Jump to application
********************************/
Address_PgrmCounter = APPLICATIONADDRESS + 4; p = (unsigned *)(Address_PgrmCounter); user_code_entry = (void *) *p; user_code_entry();