I'm using the iMX.RT1052 and I want to generate position independent code (PIC) since I want to be able to execute from any ROM location (this is so I can store and run multiple versions of firmware from the flash). However, I've been having trouble generating PIC on 'MCUXpresso v10.2.0 [Build 759] [2018-05-15]' using 'arm-none-eabi-gcc version 7.2.1 20170904' that came with the IDE. I have all options for compiling/linking PIC defined:
However when I look at the assembly generated by this, all function calls are relative branches (bl 0x60XXXXXX, etc) which is obviously dependent on position in ROM. I know that these options are doing something because now all my global variables in RAM are accessed via the global offset table (GOT) but this is not my goal. Having only the RAM be position independent is pointless as the same RAM banks are being used regardless of which ROM address the code is running from.
Does anyone have any experience with generating PIC code for the iMX.RT or is this simply an impossibility at the current time?