Skip to main content
PChig.1
Associate
December 2, 2020
Question

Issue on HAL_Delay after jump from bootloader

Hi,

I am working on STM32F401VE, I recently wrote a bootloader program, which is doing its job of jumping to a specified location. 

Now my bootloader(at addr 0x08000000) is able to jump to my main application(at addr 0x08020000 ), but when I see my main application getting executed , It stops at the very first HAL_Delay() statement. (i try to remove HAL_Delay, but i have a problem on sleep mode)

On Bootloader, my SCB->VTOR = 0x08000000, and on my application 0x08020000 ;

If i launch my application without bootloader at addr 0x08000000, everything is ok.

Can anyone please help me? 

Regards,

Pascal

This topic has been closed for replies.

5 replies

KnarfB
Super User
December 2, 2020

"stops" means what? Endless loop? Fault? HAL_Delay waits for a counter to reach a certain value. The counter is incremented by SysTick. Is SysTick handler running?

Tesla DeLorean
Guru
December 2, 2020

Did you disable interrupts and then forget to enable them?

​

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
PChig.1
PChig.1Author
Associate
December 2, 2020

Hi,

I found the solution, I need to add two line at the main.c

SCB->VTOR = 0x8020004 and not 0x8020000 (not sure to understand why )

and

__enable_irq();

Thanks for all

Pascal

Tesla DeLorean
Guru
December 2, 2020

Sure it is the latter rather than the former.

The VTOR is generally required to be on a 512-byte boundary for most STM32, as the core simply doesn't hold/use the lower order bits when it does the address substitution.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..