Forum Rule: Always post complete source code & details to reproduce any issue!
-
Yet another Makefile for the Teensy 3.1, nearly bare-metal
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/te...-1-bare-metal/
Last edited by Los Frijoles; 04-28-2014 at 07:12 AM.
-

Originally Posted by
Los Frijoles
rather than resorting to ye ole makefiles....
Did you consider using either of these freeware IDEs? I could not go back to simple editors vs. a real IDE as below with syntax-based editing, refactoring, intellisense or equiv. These speed up my work a great deal, esp. with complex multi-file projects.
Visualmicro.com
Eclipse
-
SublimeText is quite capable as an IDE...
I personally use SublimeText with the option in Arduino to use an external editor. In SublimeText I have a build setting that will verify or verify/upload my sketch so I basically never deal with the Arduino app itself.
-

Originally Posted by
nlecaude
SublimeText is quite capable as an IDE...
I personally use SublimeText with the option in Arduino to use an external editor. In SublimeText I have a build setting that will verify or verify/upload my sketch so I basically never deal with the Arduino app itself.
Hi.
I am using Notepad++ in a similar way.
Can you provide the settings or the way to call "verify" or "verify/upload" externally by sublime or Notepad++?
Thanks.
-
Well I'm on mac so I'm using AppleScript:
https://gist.github.com/natcl/3c322b1b499361d586c2
There must be a way to do something similiar using Windows...
-
I gave the Makefile a try in Linux with my the arm-none-eabi toolstring provided with Teensyduino. I successfully built the blinky example, but when I tried to port it to my project which uses external libraries, it seems to have some problems
The error I'm running into is in teensy3/keylayouts.h:5414:14: error: 'KEYCODE_TYPE' does not name a type.
There are quite a few errors after that, but with these things I think its usually the first that you've got to solve, then the other ones may go away...
Have you tried your Makefile while using more features of the teensy3.1?
-
Thanks for the makefile, it helped show me why mine wasn't working. Have you tried getting usb debug only to work?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules