Go Down

Topic: Arduino from the command line (Read 2285 times) previous topic - next topic


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: http://www.arduino.cc/playground/Learning/CommandLine


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?



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.


Dec 28, 2006, 04:54 am Last Edit: Dec 28, 2006, 05:17 am by mturcios Reason: 1
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 Compiler.java, Uploader.java, 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: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1157400799

I was comparing what files are compiled in the makfile (http://www.arduino.cc/en/uploads/Hacking/Makefile) 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.



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 http://www.arduino.cc/en/Hacking/Preferences for its location)

Go Up