Hello
I made a separate bootloader to run a freertos application. I have done this many times before but this time using STM32H753 the process has been slightly different from the past. So I wanted to document it here in case anyone else experiences the same problem.
The bootloader is a fairly simple mainloop type program without freertos. It start the Freertos application with the code recommended by ST as follows.
void StartApplication(void)
{
HAL_RCC_DeInit();
HAL_DeInit();
/* Jump to user application */
JumpAddress = *(volatile uint32_t*) (USER_FLASH_FIRST_PAGE_ADDRESS + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application’s Stack Pointer */
__set_MSP(*(volatile uint32_t*) USER_FLASH_FIRST_PAGE_ADDRESS);
Jump_To_Application();
/* do nothing */
while(1);
}
This has worked before with STM32F4 series and also works with STM32H753 if the application is a non-freertos application. In this project the problem was that every second reset (eg a HAL_NVIC_SystemReset(), or a reset from the debugger) would hang in the application inside xPortPendSVHandler. Bootloader started and run normally. If booted by powercycle, then no problem.
The fix is simple, need to disable interrupts before jump_to_application():
void StartApplication(void)
{
HAL_RCC_DeInit();
HAL_DeInit();
__disable_irq();
/* Jump to user application */
JumpAddress = *(volatile uint32_t*) (USER_FLASH_FIRST_PAGE_ADDRESS + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application’s Stack Pointer */
__set_MSP(*(volatile uint32_t*) USER_FLASH_FIRST_PAGE_ADDRESS);
Jump_To_Application();
/* do nothing */
while(1);
}
Now it works. Maybe someone finds this useful.