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