BTW, a good start is:
1) Read the Arduino core source code!
2) OK, now go read the mpide source code that implements the same functions on PIC32. Or the Energia code for MSP430. How is it different? Why?
3) Now, improve something in one of those. Write a digitalWriteFast function (yet another one, but that doesn't matter.) Implement a pin as a c++ template/object instead of the current version. Make it so that the serial port data structures for the 4 serial ports on a MEGA are dynamically allocated at begin() time and don't use up so much RAM; shucks, go ahead and make the buffer sizes user-configurable. There's lots of "bad" code in the Arduino core and libraries that's not getting fixed because of "momentum." But that shouldn't stop YOU from fixing it!
4) port the Arduino/mpide/Energia core to a "similar" environment, like an Atmel "XPlained" board, or an NXP LPCXPresso board.
5) port the core to a NOT similar environment, like one of those Renesas eval boards that they like to give away, or a Freescale Coldfire Tower Board.
People tend to treat systems like Arduino as either Evil because "they're too easy", or Wonderful because "they're so easy." But it is a useful LEARNING EXPERIENCE to STUDY such systems!