6

Right now I am using the standard Arduino IDE 1.0.1.

Yet I find both the IDE itself flunky and myself editing the code in other editors only to have to copy paste it inside the IDE and upload it there to my Arduino.

I really dislike this workflow.

So I am wondering: Is there a different way to deploy an Arduino project at best via commandline? Basically I am looking for a way to run something like arduino deploy /path/to/project /dev/ttyUSB0 from bash.

2
  • 3
    Another tool to be aware of is the ino tool available at inotool.org Commented Mar 3, 2013 at 20:42
  • 1
    @DavidK Why don't add it as an answer then? At best with example :] Commented Mar 4, 2013 at 11:51

3 Answers 3

6

You need a program called avrdude to upload the binary onto your target, and modify the parameters according to your setup and target:

mcu=atmega8
f_cpu=16000000
format=ihex
rate=19200
port=/dev/ttyusb0
programmer=stk500
target_file=test.hex

avrdude -F -p $mcu -P $port -c $programmer -b $rate -U flash:w:$target_file

If you're on a Debian or an Ubuntu machine, you should be able to do this to install avrdude:

sudo apt-get install avrdude 

Otherwise you should be able to grab the sources from here and build it yourself.

Also there is a comprehensive Makefile that you could use to build and upload to your Arduino which again uses the similar avrdude commands to upload to the target. After changing the parameters in the Makefile, run make upload to upload the hex file to the target.

NOTE: You need to have gcc-avr and avr-libc packages installed to build the binaries (which from the question looks like you're already doing).

Sign up to request clarification or add additional context in comments.

Comments

1

Following are two options which you can try

Arduino 1.5.x only

If you are using Arduino 1.5.x then you can use the arduino executable can accept commandline parameters.

Note that Arduino 1.5.x is still in beta, so you may face some issues.

Arduino 1.0.x

If you are using Arduino 1.0.x then you can use my makefile for Arduino which can be used to compile and upload Arduino (or plain AVR C) programs to Arduino from the commandline.

Following are some of the important features of this makefile

  • Supports upload via Arduino as ISP or any programmer
  • Communicate with Arduino through serial
  • Supports compiling plain AVR C programs
  • Supports user as well as system libraries.
  • Generate assembly and symbol files
  • Program using alternate Arduino core (like ATtiny or Arduino alternate cores)

Comments

0

I have made a arduino builder for ubuntu/linux which helps

  • Build
  • Upload
  • Listen serial port
  • Track changes in sketch files

Builder and instructions how to setup everything can be found here: https://github.com/limitium/arduino_builder

Also you can see small demonstration video about it here: https://youtu.be/Nu3YGMoXORI

1 Comment

Please do read How to offer personal open-source libraries? before posting more about your project on Stack Overflow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.