Showing results for 
Search instead for 
Did you mean: 

Jump to bootloader from application is not Working

Harwinder Singh
Associate II

Hi Guys, 

I am working on STM32F446 MCU. Everything is running fine. I just want to implement firmware upgrade over UART. As we know UART bootloader is already available in system memory we just need to jump over there to run it. I Have used below code to do so.





void JumpToBootloader (void)
uint32_t i=0;
void (*SysMemBootJump)(void);

	/* Disable all interrupts */

	/* Disable Systick timer */
	SysTick->CTRL = 0;

	/* Set the clock to the default state */

	/* Clear Interrupt Enable Register & Interrupt Pending Register */
	for (i=0;i<5;i++)
	/* Re-enable all interrupts */
	/* Set up the jump to boot loader address + 4 */
	SysMemBootJump = (void (*)(void)) (*((uint32_t *) ((BootAddr[MCU] + 4))));

	/* Set the main stack pointer to the boot loader stack */
	__set_MSP(*(uint32_t *)BootAddr[MCU]);
	/* Call the function to jump to boot loader location */

	/* Jump is done successfully */
	while (1)
		/* Code should never reach this loop */





It works perfectly if i Call it in beginning of main function before calling HAL_Init().  But if I call same code after one or two lines ( HAL_Init(); SystemClock_Config(); ) Then it stop working. I tried to call HAL_DeInit Before calling this but it will not works at all. I know i am missing something, please guide me to solve this issue. @B.Montanari

@Tesla DeLorean  

ST Employee

Hello @Harwinder Singh

Make sure to set the address of the entry point to bootloader at 0x1FFF0000. 

System memory bootloader address is mentioned on AN2606 and for STM32F446.

When your question is answered, please close this topic by clicking "Accept as Solution".

Hi lmen.D , Thanks for prompt reply. Yes i have used the same address. Thing is that it works properly when called after reset but not working after executing some code. Also same code was working with keil in an early project but not working in CubeIDE.