Upload to Due via command line


Is it possible to upload to an Arduino Due via the command line? For the --board property I've tried using arduino:avr:due which isn't recognized.

Or more generally, how does one find out what --board value to use for each board?


For Arduino Due (Native USB Port) it should be:

--board arduino:sam:arduino_due_x

For Arduino Due (Programming Port)

--board arduino:sam:arduino_due_x_dbg

EmbrioEmbedded: Or more generally, how does one find out what --board value to use for each board?

The format is --board package:arch:board[:parameters] package - the vendor - this is determined by the folder for example in the Arduino IDE install folder all boards in the C:\Program Files (x86)\arduino-1.6.6\hardware\arduino folder will use arduino for the package value

arch - architecture - this is also determined by the folder. For example Due boards package is installed to(on Windows): C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\sam

board - This is found in the boards.txt file for the board for example C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\boards.txt has the line

arduino_due_x_dbg.name=Arduino Due (Programming Port)

So the board value for that board is arduino_due_x_dbg

You can see more information on command line here: https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc

Thanks so much! This has been causing me a lot of headaches, this info will be very helpful.

Yes, thank you guys! I have been trying to do this with the Mega 2560 I finally got it working with this code:

"C:\Program Files (x86)\Arduino\arduino.exe"  --board arduino:avr:mega --port COM4 --upload "C:\sketches\stepper_Revolution_back_and_forth\stepper_Revolution_back_and_forth.ino"