# Entry to Freertos from a separate bootloader result in fault in xPortPendSVHandler

**URL:** <https://forums.freertos.org/t/entry-to-freertos-from-a-separate-bootloader-result-in-fault-in-xportpendsvhandler/23843>\
**Category:** ST\
**Created:** [September 11, 2025, 7:22am UTC](https://forums.freertos.org/t/entry-to-freertos-from-a-separate-bootloader-result-in-fault-in-xportpendsvhandler/23843 "2025-09-11T07:22:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toroid82](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/toroid82/32/5611_2.png) [@Toroid82](https://forums.freertos.org/u/Toroid82)\
**Post date:** [September 11, 2025, 7:22am UTC](https://forums.freertos.org/t/entry-to-freertos-from-a-separate-bootloader-result-in-fault-in-xportpendsvhandler/23843/1 "2025-09-11T07:22:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [September 11, 2025, 9:15am UTC](https://forums.freertos.org/t/entry-to-freertos-from-a-separate-bootloader-result-in-fault-in-xportpendsvhandler/23843/2 "2025-09-11T09:15:02Z")

</div>

Thank you for sharing!
