cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4A6RG Jumping to application address

Ellis Huang
Associate
Posted on August 28, 2017 at 08:46

I divided internal Flash to two part as below:

1. bootloader start address: 0x08000000 (size: 0x8000)

2. application start address: 0x08008000

Now,

I'm using the following code in bootloader to jump to application, it's not work.

but it's work on STM32L475RE.

#define BOOTLOADER_START_ADDRESS          0x08000000

#define BOOTLOADER_SIZE                                 0x8000

#define APP_START_ADDRESS                            (

BOOTLOADER_START_ADDRESS

+

BOOTLOADER_SIZE

)

void JumpToApplication(void)

{

    pFunction appEntry;

    uint32_t appStack;

    HAL_RCC_DeInit();

    HAL_DeInit();

    __disable_irq();

    appStack = (uint32_t) *((__IO uint32_t*)APP_START_ADDRESS);

    appEntry = (pFunction) *(__IO uint32_t*) (APP_START_ADDRESS + 4);

    __set_MSP(appStack);

    appEntry();

    while(1);

}
2 REPLIES 2
GreenGuy
Senior III

I ran across this post looking for the use of HAL_DeInit and I can see that no one answered this post. The likely reason is that I do not see a question here. Anyway I am having an issue getting this to work on stm32H743. I do very much the same thing as your code snipped and I find that the HAL_DeInit call is causing a system reset. I also have noticed that the HAL_RCC_DeInit code very closely resembles the startup assembly code that IAR uses. Given those findings I would suggest that using HAL_ DeInit routines are not advisable and possibly redundant.

GreenGuy
Senior III

I do not know if this has worked for you but I found that I had to set the vector table offset in the first instruction in the main of the application being jumped to because the startup code was resetting it to 8000000 by default. It seems although you may have pointed to a new location in the linker the startup code before main does not reference the new location.