Los Frijoles
Member
I saw an article by Karl Lunt the other day here: http://www.seanet.com/~karllunt/bareteensy31.html. It talked about building to the bare metal on the Teensy 3 without any Arduino stuff. I rather dislike the Arduino IDE and so I made a couple changes allowing for the following:
* Separation of obj, src, and bin directories (which I really like rather than having all of my files mixed together)
* Mixing of C and CPP files in the source directory with different compile commands for each (pretty run of the mill, but I had never actually written a makefile capable of this before. Many thanks to Carl Lunt's example for showing how to do this)
* No need to explicitly list the files to compile aside from the Teensyduino stuff
* No dependencies other than a local installation of arm-none-eabi-gcc + binutils and an unmodified Teensyduino installation
* Avoidance of comping everything into a program that uses Teensyduino (mainly spawning from the fact that Teensyduino always includes USB support, even if its not needed, increasing the binary size).
Although I used the Teensyduino library, I tried to avoid much of the arduino stuff to help get myself down close to the bare metal. I kept the digital write/pin mode stuff along with the ISR things that are set up with Teensyduino, but I managed to cut out most everything else. The only reason I really want to do this is for binary size (to see how small I can get) since the stuff (usb configuration, etc) that comes with Teensyduino is actually rather nice and quite useful IMO.
I want to know what you guys think and see if I made any mistakes or if anyone sees problems with my approach. I plan on using sublime text as an editor along with a basic terminal for my Teensy 3 development after this point (goodbye terrible Arduino IDE with all of your open tabs). I know this isn't the most unique thing (people make Makefiles all the time ), but this is my first more complex makefile that I've actually messed around with and understood how it works.
Github repository containing the things: https://github.com/kcuzner/teensy31-blinky-bare-metal
Blog post explaining what I did and the changes I made to Karl Lunt's Makefile: http://kevincuzner.com/2014/04/28/teensy-3-1-bare-metal/
* Separation of obj, src, and bin directories (which I really like rather than having all of my files mixed together)
* Mixing of C and CPP files in the source directory with different compile commands for each (pretty run of the mill, but I had never actually written a makefile capable of this before. Many thanks to Carl Lunt's example for showing how to do this)
* No need to explicitly list the files to compile aside from the Teensyduino stuff
* No dependencies other than a local installation of arm-none-eabi-gcc + binutils and an unmodified Teensyduino installation
* Avoidance of comping everything into a program that uses Teensyduino (mainly spawning from the fact that Teensyduino always includes USB support, even if its not needed, increasing the binary size).
Although I used the Teensyduino library, I tried to avoid much of the arduino stuff to help get myself down close to the bare metal. I kept the digital write/pin mode stuff along with the ISR things that are set up with Teensyduino, but I managed to cut out most everything else. The only reason I really want to do this is for binary size (to see how small I can get) since the stuff (usb configuration, etc) that comes with Teensyduino is actually rather nice and quite useful IMO.
I want to know what you guys think and see if I made any mistakes or if anyone sees problems with my approach. I plan on using sublime text as an editor along with a basic terminal for my Teensy 3 development after this point (goodbye terrible Arduino IDE with all of your open tabs). I know this isn't the most unique thing (people make Makefiles all the time ), but this is my first more complex makefile that I've actually messed around with and understood how it works.
Github repository containing the things: https://github.com/kcuzner/teensy31-blinky-bare-metal
Blog post explaining what I did and the changes I made to Karl Lunt's Makefile: http://kevincuzner.com/2014/04/28/teensy-3-1-bare-metal/
Last edited: