cancel
Showing results for 
Search instead for 
Did you mean: 

Developing a custom bootloader for stm32f407VET. Query on reset behavior.

SPath
Associate II

My bootloader starts from 0x08000000 and my application starts from 0x08004000. After i flash the application through UART I jump to my application using the code below.

HAL_UART_DeInit(uart_handle);

 HAL_RCC_DeInit();

 HAL_DeInit();

 SysTick->CTRL = 0;

 SysTick->LOAD = 0;

 SysTick->VAL = 0;

 __disable_irq();

  /* execute the new program */

   JumpAddress = *((__IO uint32_t*) (APPLICATION_ADDRESS_BANK_1 + 4));

   /* Jump to user application */

   JumpToApplication = (pFunction) JumpAddress;

   /* Initialize user application's Stack Pointer */

   __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS_BANK_1);

JumpToApplication();

After i jump to my application the SBC->VTOR is loaded with 0x08004000 in system init and the application runs. All the interrupts are managed through the vector table of my application.

What should be the behavior when a reset occurs while my application is running. Should it go to the reset handler of my application i.e. at ox08004004 or the reset handler of my bootloader (0x080000004)

4 REPLIES 4

The reset will go to your boot loader provided BOOT0=LOW

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SPath
Associate II

Thanks.

What about a soft reset from Watch dog in my application. And also is there a way to ensure that after reset, the controller straightaway goes to my application.

The watchdog generates a reset pulse with resets the core, SCB->VTOR gets set to zero, and whatever memory is mapped there via the BOOTx pins takes control.

You could expedite the jump to your applications Reset_Handler by having the boot loader recognize a signature value in RAM in its Reset_Handler.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SPath
Associate II

Thanks a lot.

If i write a simple application it is working perfectly after switching.

But my main application is freertos based and it unexpectedly resets back to my bootloader. Am i doing my application switching correctly or do i need to do something extra do take care for my rtos based application.