cancel
Showing results for 
Search instead for 
Did you mean: 

Jump to bootloader from Azure RTOS

STarlink
Associate

Hello,

I'm having some issue going from my user code running azure RTOS to the bootloader. I'm using a STM32U599

The code I'm using is the following, you can find online:

 

void JumpToBootloader(void)
{
uint32_t i=0;
void (*SysMemBootJump)(void);
/* Disable all interrupts */
__disable_irq();
 
/* Disable Systick timer */
SysTick->CTRL = 0;
 
/* Set the clock to the default state */
HAL_RCC_DeInit();
 
/* Clear Interrupt Enable Register & Interrupt Pending Register */
for (i=0;i<5;i++)
{
NVIC->ICER[i]=0xFFFFFFFF;
NVIC->ICPR[i]=0xFFFFFFFF;
}
 
/* Re-enable all interrupts */
__enable_irq(); 
__DSB(); 
    __DSB();
    __ISB();
/* Set up the jump to boot loader address + 4 */
SysMemBootJump = (void (*)(void)) (*((uint32_t *) ((0x0BF90000 + 4))));
 
/* Set the main stack pointer to the boot loader stack */
__set_MSP(*(uint32_t *)0x0BF90000);
 
/* Call the function to jump to boot loader location */
SysMemBootJump();
 
/* Jump is done successfully */
while (1)
{
/* Code should never reach this loop */
}
}
 
It works well in baremetal when doing the jump from the main before launching Azure RTOS, I can connect with cube programmer through USB.
In Azure RTOS it causes a restart.
What could be the cause? Do I need to stop ThreadX before ?

Regards
Yann 
1 REPLY 1
faharintisar
Associate II

Jumping from rtos doesnt work for me as well, I think thats due to resources acquired by rtos, you can start your system intialiaze rtos do whatever you wanna do using rtos, set a flag in flash or rom that now you want to jump, and restart the system,,,,read the flag if its true, jump before initialization on rtos otherwise continue normal operations

Fahar