cancel
Showing results for 
Search instead for 
Did you mean: 

Issue on HAL_Delay after jump from bootloader

PChig.1
Associate

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

5 REPLIES 5
KnarfB
Principal III

"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?

Did you disable interrupts and then forget to enable them?

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

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

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
Up vote any posts that you find helpful, it shows what's working..

@PChig.1 @Tesla DeLorean  I have same problem, can you please give me proper solution for this HAL_Delay() problem?

static void goto_application(void)

{

void (*app_reset_handler)(void) = (void (*)(void))(*(volatile uint32_t *) (0x08006000 + 4));

__disable_irq();

__set_MSP((*(volatile uint32_t *)0x08006000));

__enable_irq();

app_reset_handler();

}