I've given this some more thought. I think you want to do one of these two things:
a) Run your code instead of TOS, e.g. from TOS-ROMs or as a diagnostic cartridge that gets started immediately after reset. In this case you have to initialize the MMU before you can even use RAM. (Any meaningful C program will use RAM.) How you do this is of course machine dependent; I once reverse engineered it for ST and STe. Once RAM is usable, you of course don't have to deal with an OS. So you can relocate your TEXT section to ROM and the DATA and BSS sections to an address in RAM of your choice. You have to copy the contents of the DATA section to RAM upon startup. (This is assuming Pure C code doesn't write to the TEXT section and is fine with dis-contiguous memory layout of the sections.) Also of course you have to initialize all other hardware yourself, then. Finally you have to be very careful with library calls, ensuring that they don't call any TOS functions internally.
b) Run your code from a cartridge after GEMDOS initialization or from the desktop. In this case, you cannot relocate your program at compile time, because you don't know which RAM address you can use for your data. (You will have to Malloc it upon startup.) My solution for this is to copy the whole program into Malloc'ed RAM, relocate it and run it like GEMDOS would have done. You can find this solution (with German explanation) under http://www.chzsoft.de/site/hardware/div ... -cartridge
. However, I'm presently not sure if I uploaded the latest version.
Maybe you can explain a little what exactly you're planning to do.