How to use Arduino Mega board using only C language and Arduino boot

I would like to use the Arduino IDE just to load my own C-language programs, manually
initiallizing all ports and registers, etc. but using the ARM Studio IDE ver 5 and/or Arduino IDE to download the compiled program to the Arduino 2560 board ready to run.
(somebody must be doing this!)

Crossposting isn't the way to win friends here.