Go Down

Topic: Commandline build on Windows (Read 1 time) previous topic - next topic

RichardDL

Hello,

I'm new to the Arduino and the forum.  I went looking for a command-line build for Arduino programs.  Found this http://playground.arduino.cc//Code/WindowsCommandLine, and tried abuild.bat.  It doesn't work for me, and it says 'report any problems to http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1168127321;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.

Richard.

#1
Dec 30, 2012, 05:51 pm Last Edit: Dec 31, 2012, 01:10 pm by Robot-Will Reason: 1
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
Code: [Select]
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:
Code: [Select]
compiler.c.cmd=avr-gcc
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.


Stino - A sublime text plugin for Arduino
https://github.com/Robot-Will/Stino

robtillaart

typo in the path ? arv => avr ?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Sorry for my fault. It should be avr. I have changed it.
Stino - A sublime text plugin for Arduino
https://github.com/Robot-Will/Stino

RichardDL

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

Go Up