Commandline build on Windows


I'm new to the Arduino and the forum. I went looking for a command-line build for Arduino programs. Found this, and tried abuild.bat. It doesn't work for me, and it says 'report any problems to;start=all. So I went there, but it is 'read-only' - because it's old? (or I'm new?) Is it still supported?

I just want to build the software and load the Arduino from a command line. I've tried some of the makefiles, but not managed to get one to work all the way through.

Any help appreciated.


Hi, I think you can write your own makefile to run build, but first of all you must set PATH to run commands:

Two paths are needed to set, Arduino-path is the path where you put your Arduino program:
posix command path: Arduino-path\hardware\tools\avr\utils\bin
avr-gcc command path: Arduino-path\hardware\tools\avr\bin
Use this command to set PATH

Set Path=Arduino-path\hardware\tools\arv\utils\bin:Arduino-path\hardware\tools\arv\bin

And next, write a makefile and just type ‘make’, build will run automatically.
I think a simple makefile is the best, and it just a list of commands needed.
The commands needed are listed in platform.txt(Arduino version >= 1.5), like this:

compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -MMD

## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

All the parameters are listed in boards.txt and programmers.txt corresponding to a board and a programmer.

The attachment is one of my makefile. But this makefile is just for a certain sketch, not a general purpose makefile.
I wrote a program to generate makefiles for sketches. It can read all parameters needed and write the command list to a makefile.
As my program is part of a plugin for Sublime Text 2, it is not a command line program.
I think you can write a program to do the same thing using your favorite program language.

makefile (12.4 KB)

typo in the path ? arv => avr ?

Sorry for my fault. It should be avr. I have changed it.

Thanks for that, and sorry for the delay getting back. I've upgraded to 1.5 and started looking at platform.txt.