Yes, I know the code has to run from RAM. I have two build configurations, one that locates it in RAM by default for debugging, and one that links the section into flash. When it needs to do an upgrade it copies the section from flash into RAM and runs, exactly as you described. Maybe that's what you mean by the two programs. What I want is to use this -fPIC option so that the flash update code is truly position independent, Isn't that what the -fPIC option is supposed to do? Right now, the flash code does run successfully from RAM after copying it and jumping to it, but a large case statement makes a few absolute branches to locations in flash, which is no good once you start reprogramming the flash with a different image. Does this "file2c" come with GCC? My Googling has not found a standalone Windows version. I agree that building the RAM debug version and massaging it to extract the relevant section using some third-party program to convert it to an array of char work, but seems like a kludgey way of doing it. Using the -fPIC option appears to be much more straightforward, but it doesn't seem to work the way I expect; some global variables are accessed correctly, but others are not no matter where the global offset table is located. Does the -fPIC option produce position-independent code, or not? > Thanks, but you've kind of lost me there. I don't understand what you mean by "write two programs". You want your program to run from RAM. But it start from flash. right? so it needs to be copied to RAM and then run from there and all code - except of the copy part - must be linked to addresses in RAM. right? So write 2 programs. one - your actual program. link it for RAM addresses. Use objcopy -j .text -j .rodata -j .data -O binary yourprogram.elf yourprogram.bin then convert it to C table file2c 'const mainprogram[]={' '};' <yourprogram.bin >yourprogram.table.c Then write copy program #include <yourprogram.table.c> typedef void (*progstart)(); void __attribute__ ((noreturn)) main() { const char *src; char *dst=0xBEGINNING_OF_RAM_ADDRESS; int a=sizeof(mainprogram); while(a--) *(dst++)=*(src++); //copy to RAM (*((progstart)(your_program_start_address)))(); //execute your program } compile it and put this resulting program in flash.