How to IAP in STM32 correctly, there is some problems

OK, Here is my program area.
0x08000000 30K for the BootLoader
0x08007800 226K for the main program
I use the offical BootLoader, So I shoud change these place, I do not know if I am right?

  1. open the ldscript.ld file, change the flash offset?
  2. open platformio.ini change the download offset?
  3. set the SCB->VTOR = 0x08007800;
    I know that if I set it in the setup(), it is not right, so I add it in the system_stm32l4xx.c like below,

Then I open the segger j-flash and burn the bootloader


then I use the platformIO download the program,
Then I see the log, my bootloader run suceessfully , but not jump into my user app?

could you help me, there is no same problem in the community?

If you add

build_flags = -DVECT_TAB_OFFSET=0x7800

it should work without system_stm32l4xx.c code modifiations, but the current one is also “okay”. Not sure why it doesn’t work.

What’s the source code for the bootloader?

Would you like to see this link, there kind man give me some tips.
stm32duino offical
I only change 3 places in my application, first the ld file, change the FLASH as picture,then platformio.ini as follow


,if I debug my application, step into debug mode then run, it can work sucessfully, see the 0xE000ED08(
SCB->VTOR ) it was 0x08007800, if I quit debug mode, and the MCU reset ,and it run from the bootloader, it can not jump into the application, and see the 0xE000ED08 always be 0x08000000.

I don’t know why?

I have slove the problem


The difference between two jump code as the arrow,
__set_MSP**(*(__IO **uint32_t***) APPLICATION_ADDRESS);
can work well in the GCC and KEIL, the other one just work in KEIL