Pages: [1]   Go Down
Author Topic: Commandline build on Windows  (Read 1686 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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:
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.



* makefile (12.4 KB - downloaded 15 times.)
« Last Edit: December 31, 2012, 07:10:12 am by Robot-Will » Logged

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

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13471
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

typo in the path ? arv => avr ?
Logged

Rob Tillaart

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

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: