I am working on building my application so it can be executed directly from flash (on a Stellaris/TI Cortex M3) anywhere within the flash. Has anyone done this? So far this is what I am trying: Modified the YAGARTO scripts as follows: For gcc-build: Added: CFLAGS_FOR_TARGET="-fpie" CXXFLAGS_FOR_TARGET="-fpie" For newlib-build: Added: CFLAGS="-fpie" My bootloader (which is at a fixed location) modifies the vector table of the application so that all its vectors are pointing to where the code actually resides. I also modified the startup code so that data section is updated from the correct location of flash. The problem I am still having is that when my code executes it seems that all my data is now been changed to be relative the PC. I want my code to position independent but I would like to keep the data at the same locations in the internal sram. So far I am not linking with -pie option as when I do my code does not execute at all. I suspect that I may need to link with -pie as it seems to add a .dynamic section (in my data section) to my map file which might be necessary. I am not sure if I need to make modifications to the .dynamic section to have it point to the correct locations in flash in the startup code.