T3.2 How to compile Arduino .ino file and obtain HEX file from command line

Status
Not open for further replies.

daanv

Member
helloo :)
I'm trying to find a way to compile an Arduino .ino file and obtain the output HEX/ELF file, from command line (on windows). Uploading to the board will be done via JTAG and a programmer, so I don't need the TeensyLoader.

So far I've come across the following:

  • There is the Teensy loader, command line. However I understand it that is only for loading already compiled code onto the Teensy Board, not for compiling .ino files. So that is of no use.
  • Then there is the GCC compiler for Teensy. That would mean using a make file. I'm not very familiar with using Make, would I then still be able to compile an arduino file? Or does it only work with .c or .cpp files? Besides, it seems to cover teensy 2 only. Would it also work for T3.2? I came across this discussion, but it doesn't show anything about .ino files. It's also from more than 5 years ago so things could've changed since then.
  • I've tried copying the first line from verbose output from Arduino IDE upload, and pasting that in the CMD/Powershell.
    The command is this:
    Code:
    "C:\Program Files (x86)\Arduino\arduino-builder" -dump-prefs -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -hardware "C:\Users\xxxe\AppData\Local\Arduino15\packages" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -tools "C:\Users\xxxx\AppData\Local\Arduino15\packages" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\xxx\Documents\Arduino\libraries" -fqbn=teensy:avr:teensy31:usb=serial,speed=96,opt=o2std,keys=en-us -ide-version=10813 -build-path "C:\Users\xxxx~1\AppData\Local\Temp\arduino_build_755527" -warnings=none -build-cache "C:\Users\xxxx~1\AppData\Local\Temp\arduino_cache_486966" -verbose "R:\ardir\blink.ino"
    The error I get is:
    Code:
    At line:1 char:50
    + "C:\Program Files (x86)\Arduino\arduino-builder" -dump-prefs -logger= ...
    +                                                  ~~~~~
    Unexpected token '-dump' in expression or statement.
    At line:1 char:55
    + "C:\Program Files (x86)\Arduino\arduino-builder" -dump-prefs -logger= ...
    +                                                       ~~~~~~
    Unexpected token '-prefs' in expression or statement.
        + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : UnexpectedToken
    Tried looking this up, didn't get very far.

Any suggestions on what direction to proceed on would be appreciated a lot! Many thanks
 
There are a few different options that I know of.

There are makefiles that can build teensy sketches. I have not tried them in awhile or know how well they are working on windows...
But they are found in your <arduino install>/hardware/teensy/avr/cores/teensy4 ... Or teensy3 ...

@FrankB and @defrasger setup a set of batch files TSet... Which are a set of batch files that work on windows. Dragster setup a way to integrate into sublimetext editor and I use this setup a lot. One nice thing about this setup is it uses the Arduino build system to build... So I get the same results as I do from doing build within the IDE
 
Status
Not open for further replies.
Back
Top