2020-12-02 01:27 AM
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
2020-12-02 02:21 AM
"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?
2020-12-02 03:14 AM
Did you disable interrupts and then forget to enable them?
2020-12-02 07:21 AM
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
2020-12-02 07:42 AM
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.
2024-10-15 11:25 PM - edited 2024-10-16 02:54 AM
@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();
}