AnsweredAssumed Answered

Linking/ Compiling a program so that it is flash address independent?

Question asked by gearhead1107 on May 17, 2018
Latest reply on May 29, 2018 by Jiri Kral

I'm trying to develop a way to update the boot-loader application on my S32. To do this, I'm trying to copy the "old" boot-loader to a new location in flash, and jump to it. After running the "old" boot-loader in the new location, the idea is that it will erase the old location and flash the *new* boot-loader.


I've also seen this done where there are always two boot-loaders, one new and one old, in two different locations. However, the problem I'm having exists for both scenarios:

After jumping to the old binary in the new location (0x70000 rather than 0x10000), there are inevitably address for functions that get jumped to explicitly. The following example is from the startup code (although this happens elsewhere in text.main if I skip startup), where the CPU is jumping to an address 0x19E01 as indicated in the binary file that used to be at 0x10000.Screenshot of program jumping to address indicated by binary


How can I compile this program so that subroutines that used to run at 0x19E01 will now just run at 0x79E01?


Thank you