Arduino from the command line

For anyone who's ever wanted to compile Arduino programs without the bother of Java or the cheerful gaudiness of the Arduino environment, here are instructions for using Arduino from the command line:

Great !

I followed the instructions in the makefile but when I type 'make' I get an error saying that 'make is not recognized as an internal or external command, operable program or batch file.' This is because I don't have a program that can execute makefiles. I went to download GNU Make but couldn't get it to compile correctly. Does anyone have a link to a binary copy or another idea to help me run the makefile?

Thanks fillalph

what platform are u working on?


Hi. I am running Windows XP.


I am using cygwin, and it works great, make to compile, then make upload to upload the .hex file to the arduino.

I'm working on the same project that fillalph. What we are trying to do is have a GUI in Windows that will take certain user defined input values, stick them into a source file, then compile and upload that file to the Arduino board. Using a makefile would eliminate some steps, but would also require a way to run makefiles.

Since we want to be able to install this setup on other systems, the fewer additional components we need to install the better (which precludes the cygwin approach). At this point we are trying to find the simplest way to get out GUI to compile and upload. Also, assuming we end up using the makefile approach, how do you deal with Windows (filepaths with spaces and all) in makefiles?

We just about have our GUI, so finding the best way to compile and upload from that point is the next step, hopefully looking to get it complete in 3 weeks or so.

Thanks in advance.

If your GUI is written in Java, you should be able to take the,, etc. from the Arduino source and include it. Otherwise, to avoid the use of Makefiles, you could replicate their functionality in your code (it's a question of assembling the right command line arguments). In both cases, however, you will need avr-gcc, uisp, etc. which are the external executables that actually compile and upload the code. These are written in C/C++, so you'll need a version compiled for each platform you want to support (or you could just copy them from the Arduino distribution).

Otherwise, to avoid the use of Makefiles, you could replicate their functionality in your code (it's a question of assembling the right command line arguments).

You have actually done this here if I am correct:

I was comparing what files are compiled in the makfile ( and what are compiled in the command file link posted above.

makefile: pins_arduino.c, wiring.c, WInterrupts.c, foo.cpp, HardwareSerial.cpp, WRandom.cpp (note: I couldn't figure out what $(ASRC) points to) command file: buffer.c, pins_arduino.c, Serial.c, uart.c, wiring.c, foo.cpp, HardwareSerial.cpp, WRandom.cpp

The command file has the following extra files: buffer.c, uart.c The makfile has the following extra files: WInterrupts.c

Just curious if the command file needs more object files or has too many or both.

Thanks fillalph

The command file?

The Arduino core has been updated since the forum post you refer to. The Makefile was updated to refer to the new files. To get the Arduino IDE to dump the command lines it uses, change the “build.verbose” constant in your preferences file to true. (see for its location)