Hi,
I've created a custom firmware update process on a TI TM4c1294NCPDT (Arm Cortex-m4f) and have divided the flash into 2 partitions. I'd like to be able to build one image that will work in either of the partitions but so far haven't figured out how to do this. I tried the -fPIC compiler flag but that didn't work. So far I have to create 2 separate images, 1 for each partition. For each of the 2 images I have to specify the location in memory in the linker script. Any suggestions on how it's possible to build a position independent image?
Thanks,Doug Burrell
-fPIC "didn't work" how, exactly? i suspect you'd need to recompile libraries and perhaps startup code with -fPIC as well (probably easier said than done...)
The code appears to work, flashing LEDs are behaving normally, however the information written to the display is garbage and the watchdog is not being kicked as it should be if the code were operating normally. So I've rebuilt the driver library from TI but I have the standard C library that's included with the GNU toolchain from ARM... so I guess that's probably the best bet to try next. Any idea where I can get the source code for that? One other odd thing to report: I have the main application and a bootloader application and when I build the bootloader with the -fPIC compiler flag the size of the binary becomes ~500Mb. I'm not sure what's going on there.
Thanks,Doug
AFAIK, the C library included with the gcc toolchain is "newlib nano" in .../src/newlib; there is also libgcc which is at .../src/gcc/libgcc (both paths from the Source tar file you get from launchpad.net, next to the binaries...)
It might be quicker to compile with "-nostdlib" and add or replace code as needed than starting by trying to recompile the existing libraries.I should qualify that I don't have any actual experience with ARM PIC. I wouldn't be surprised if it is an ARM-32 option that doesn't even work on thumb-only chips like the Tiva :-( From your description, and the documentation on the ARM page, you want "Read Only Position Independence" - you want to put the code anywhere, but it's OK for RAM/Data accesses to be absolute, since only one of your images will run at a time...
Maybe you have to set also -mpic-data-is-text-relative and --pic-veneer.