2019-10-03 01:43 AM
I am working on IAP boot-loader where the user application store either in 2 sector in which update comes in other sector respect to the current sector. So I need to build user app memory independent but I don't know how to do it. Could someone help?
2019-10-03 09:51 AM
The compiler should have options to generate more "address independent" code, and the linker can output object files which can be loaded and relocated in memory.
One of the problems with the Cortex-M is that the vector table contains absolute addresses, so even if all the other code is independent you'll still need to resolve the vector table addresses.
One experiment you can do is build two binary images at different addresses and then do a file compare to confirm the only fixed addresses where within the vector table. If that is the case the vector table can then be adjusted as part of the flash update process depending on where you are placing the application.
2019-10-03 09:25 PM
Yeah I tried address independent option in keil linker option but the start up program file show error when I compile.
2019-10-03 10:24 PM
I also tried your experiment suggestion and yes the address are changing at some specific byte location example app build at 0x08020000 is having byte value of 0x02 at many places and app build at 0x08060000 is having byte value of 0x06 at the same place where 0x02 is placed. So How will I change it?