STM32 bin file at address 0x4
..
..
This seems unnecessarily complex and laboured.
Typically you build an app for a specific address, via the linker. The Vector Table is part of the image. The SystemInit() code can set the address of SCB->VTOR based on the symbol the linker assigns the table in a given build. The application should and can be agnostic to the location it's built to live.
You put the Loader at 0x08000000, App1 at 0x08008000, App2 at 0x08020000, or however they need to space related to the size of the respective images and the space available in the FLASH. These BASE addresses are the only thing the Loader really needs to know.
The Vector Table contains the entry point (Reset_Handler) and you hand off control there.
It's also not hard to embedded length of image data in there too if need be.
Most of the CM3 from ST will want the vector table to live at a 512-byte boundary, but this depends on the size and total number of vectors, rounded to the next power of 2
The LINKER is DESIGNED to compute and solve placement problems, and fixate addresses, it can use and generate symbols, let it do the hard work by doing it's job.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.