How to Jump,correctly, to application on a bootloader?
Hi,
I'm using the STM32H743 Nucleo Board, to development a bootloader code with USB_MSC, I based my code on the "STM32H743I_EVAL" this is the address to the file "STM32H743I_EVAL\Applications\USB_Host\FWupgrade_Standalone" and everything work good, at the end of the process i can see the exactly hex code, what I donwloaded on my Pen Drive, in the flash memory.
But the problem is, when reset the code with NVIC_SystemReset() ,the Jump Function don't work, and really dont know why, I suppose it is something about the interrupt vectors or the deincialisations that must be done before, however I dont know what I need to do.
I saw this post https://community.st.com/s/question/0D50X00009hmVzpSAE/stm32h743-is-there-a-different-handling-for-code-entry-points-compared-to-stm32f4-stm32f7?t=1544011706860 who GS@G said that we need to enable the interrupts on "the other side", can't understand this.
I'm use 0x08020000 to APPLICATION_ADDRESS, and this jump code to:
int main ()
{
FLASH_If_FlashUnlock();
// SysTick->CTRL = 0x000;
// SysTick->LOAD = 0x000;
// SysTick->VAL = 0x000;
// SCB->VTOR = APPLICATION_ADDRESS;
JumpAddress = (*(__IO uint32_t*)APPLICATION_ADDRESS);
if ( ( JumpAddress & 0x2FFE0000) == 0x20320000)//0x20000000
{
/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
Jump_To_Application();
}
MPU_Config();
CPU_CACHE_Enable();
HAL_Init(); ...
}
If anyone can help, I would be grateful. Thanks.
