Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Yet another Makefile for the Teensy 3.1, nearly bare-metal

  1. #1

    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 08:12 AM.

  2. #2
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    Quote Originally Posted by Los Frijoles View Post
    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 ...
    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

  3. #3
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    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.

  4. #4
    Member
    Join Date
    Mar 2014
    Location
    Übersee, Germany
    Posts
    40
    Quote Originally Posted by nlecaude View Post
    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.

  5. #5
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    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...

  6. #6
    Junior Member
    Join Date
    Feb 2014
    Posts
    15
    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?

  7. #7
    Junior Member
    Join Date
    May 2014
    Posts
    5
    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
  •