File: arduino-cli.html

package info (click to toggle)
arduino-mk 0.8-5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 252 kB
  • sloc: perl: 214; makefile: 4
file content (478 lines) | stat: -rw-r--r-- 27,759 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Martin's Atelier: Arduino from the command line</title>
    <link rel="alternate" type="application/atom+xml" href="../../feed.atom" />   
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="robots"      content="all" />
    <meta name="author"      content="Martin Oldfield" />
    <meta name="keywords"    content="Arduino command line Makefile" />
    <meta name="description" content="" />    
    <style type="text/css" media="all">@import "../../std.css";</style>
    <style type="text/css" media="print">@import "../../print.css";</style></head>

  <body>
    <div id="wrapper">
      <div id="header">
        <img id="logo_col" src="../../gears.png"/>
        <img id="logo_bw"  src="../../gears_bw.png"/>
        <h1>Arduino from the command line</h1>
      </div>
      <div id="main">
        <h2>Update News</h2>

<p>2012-02-12 : After letting this languish for over six months, there&#39;s now <a href="http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.8.tar.gz">version 0.8</a><span class="link_list"><sup>1</sup></span> which:</p>

<ul>
<li>Supports version 1.0 of the official Arduino <span class="caps">IDE.</span></li>
<li>Compiles the system software to a library potentially making the   final executable smaller.</li>
<li>Supports plain C files in system libraries.</li>
</ul>

<p>In principle version 0.8 should work with older releases of the Arduino <span class="caps">IDE </span>but I&#39;ve not checked it. If you do upgrade to 1.0 though, you&#39;ll need to rename your .pde files to .ino.</p>

<h2>Introduction</h2>

<p>The <a href="http://www.arduino.cc/">Arduino</a><span class="link_list"><sup>2</sup></span> has done much to popularize microcontrollers for the casual tinkerer. Its success suggests that there&#39;s considerable value in combining a standard microcontroller (the ATmega) and a <span class="caps">GCC </span>based toolchain into an easily digesible package. For myself, it&#39;s certainly easier to just install the latest release of the Arduino software than worry about building my own cross-compilers, particularly when it&#39;s all new to me and consequently somewhat confusing.</p>

<p>After working through the toy tutorials though, I found myself wishing that writing code for the Arduino were more like writing other C programs. In my case, that means editing it with emacs then building it with make. I must emphasize that I&#39;m not criticizing the Arduino <span class="caps">IDE</span>: there&#39;s nothing wrong with it beyond it not being emacs...</p>

<p>It turns out that others have been along this path before: in the past the Arduino website had a hopeful sounding &#39;Arduino from the Command Line&#39; article, but it&#39;s gone now. There is still <a href="http://arduino.cc/en/Hacking/HomePage">some information</a><span class="link_list"><sup>3</sup></span> though it&#39;s more limited.</p>

<p>Without an official Makefile, I wrote my own. You might wonder why I should embark on such a task. Well:</p>

<ul>
<li>I was keen that all of my objects and random other files were   completely separate from the main Arduino stuff in the applet   directory.</li>
<li>Although I wanted to be able to build Arduino sketches, I also   wanted a suitable jumping-off point for code which didn&#39;t use   wiring. In other words, to regard the Arduino software as a   convenient way to get the <span class="caps">AVR GCC </span>toolchain.</li>
<li>Rather than dumping a big Makefile in each sketch directory, I   wanted to have a few definitions in the directory which then   included a large project-independent file from elsewhere.</li>
</ul>

<p>Finally, one of the things I enjoy about writing code for microcontrollers is the sense of continuity between the hardware datasheets published by the chip manufacturer and the code I write (by contrast if you&#39;re writing code on Linux there&#39;s a vast gulf between the code executing printf and stuff appearing on the screen). Writing my own Makefile seemed a good way to make sure I understood what was going on.</p>

<p>So to the Makefile. Obviously it owes a great debt to the people who wrote the Makefile shipped with the Arduino <span class="caps">IDE </span>and here&#39;s the credit list from that file:</p>

<pre><code># Arduino 0011 Makefile
# Arduino adaptation by mellis, eighthave, oli.keller</code></pre>

<p>Thanks then to mellis, eighthavem and oli.keller.</p>

<h2>Installation instructions</h2>

<p>If you&#39;re using Debian or Ubuntu, then just grab the arduino-core package.</p>

<p>You&#39;ll need to download <a href="http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.8.tar.gz">the tarball containing the Makefile,</a><span class="link_list"><sup>4</sup></span>, unpack it, and then copy the Makefile somewhere sensible:</p>

<pre><code>$ wget http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.8.tar.gz
$ tar xzvf arduino-mk_0.8.tar.gz
$ cp arduino-mk-0.8/Arduino.mk /path/to/my/arduino/stuff/Arduino.mk
$ cp arduino-mk-0.8/ard-parse-boards /usr/local/bin</code></pre>

<p> The next step is to create a small Makefile for the sketch you actually want to build. Let&#39;s build the <a href="http://arduino.cc/en/Tutorial/WebServer">WebServer example</a><span class="link_list"><sup>5</sup></span> from the Arduino distribution: it&#39;s a good example because software-wise it&#39;s as complicated as the stardard examples get, but you can just plug the hardware together.</p>

<p>Create a new directory and copy the WebServer.ino file into it. Now this we&#39;ll add a Makefile:</p>

<p><strong>Note: If you&#39;re using version 1.0 of the Arduino software, you&#39;ll  need to make sure that the sketch&#39;s name ends in .ino and not .pde.</strong></p>

<pre><code>ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java

BOARD_TAG    = uno
ARDUINO_PORT = /dev/cu.usb*

ARDUINO_LIBS = Ethernet Ethernet/utility SPI

include /path/to/my/arduino/stuff/Arduino.mk</code></pre>

<p>Hopefully these will be self-explanatory but in case they&#39;re not:</p>

<dl>
<dt><span class="caps">ARDUINO</span>_DIR</dt>
<dd>Where you installed the Arduino software. On the Mac this has to point deep inside the Arduino installation /Applications.</dd>
<dt><span class="caps">ARDUINO</span>_LIBS</dt>
<dd>A list of any libraries used by the sketch&mdash;we assume  these are in $(ARDUINO_DIR)/hardware/libraries.</dd>
<dt><span class="caps">BOARD</span>_TAG</dt>
<dd>A tag identifying which type of Arduino you&#39;re using. This only works in version 0.6 and later.</dd>
<dt><span class="caps">ARDUINO</span>_PORT</dt>
<dd>The port where the Arduino can be found (only needed when  uploading) If this expands to several ports, the first will be used.</dd>
</dl>


<p>Until version 0.8 you had to specify a <span class="caps">TARGET </span>name which set the basename for the executables. You still <em>can</em> do this, but it&#39;s not necessary: thanks to a patch from Daniele Vergini it now defaults to the name of the current directory.</p>

<p>In the past, the following options were used, and indeed you can still use them. However it&#39;s probably better to use set <span class="caps">BOARD</span>_TAG and let the Makefile look up the values in boards.txt:</p>

<dl>
<dt><span class="caps">MCU</span></dt>
<dd>The target processor (atmega168 for the Duemilanove).</dd>
<dt>F_CPU</dt>
<dd>The target&#39;s clock speed (16000000 for the Duemilanove).</dd>
<dt><span class="caps">AVRDUDE</span>_ARD_PROGRAMMER</dt>
<dd>The protocol avrdude speaks&mdash;defaults to stk500v1.</dd>
<dt><span class="caps">AVRDUDE</span>_ARD_BAUDRATE</dt>
<dd>The rate at which we talk to the board&mdash;defaults to 19,200.</dd>
</dl>


<p>If you&#39;re using the toolchain provided by the system rather than bundled with the Arduino software (as I think is the case on Linux) then you&#39;ll have to add some more paths:</p>

<pre><code>AVR_TOOLS_PATH   = /usr/bin
AVRDUDE_CONF     = /etc/avrdude.conf</code></pre>

<h3><span class="caps">BOARD</span>_TAG</h3>

<p>Makefiles before version 0.5 had to specify which processor and speed the target used. For standard boards, this information can be found in the boards.txt file, so it seemed sensible to use that instead.</p>

<p>Now, one need only define <span class="caps">BOARD</span>_TAG to match the target hardware and it should work. Internally the Makefile invokes ard-parse-boards&mdash;a small Perl utility included with the software&mdash;which parses board.txt.</p>

<p>If you&#39;re not sure which board tag you need, ard-parse-board will dump a full list:</p>

<pre><code>$ ard-parse-boards --boards						
Tag          Board Name							
atmega168    Arduino NG or older w/ ATmega168				
atmega328    Arduino Duemilanove or Nano w/ ATmega328			
atmega8      Arduino NG or older w/ ATmega8				
bt           Arduino BT w/ ATmega168					
bt328        Arduino BT w/ ATmega328					
diecimila    Arduino Diecimila, Duemilanove, or Nano w/ ATmega168	
fio          Arduino Fio						
lilypad      LilyPad Arduino w/ ATmega168				
lilypad328   LilyPad Arduino w/ ATmega328				
mega         Arduino Mega (ATmega1280)					
mega2560     Arduino Mega 2560						
mini         Arduino Mini						
pro          Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega168		
pro328       Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328		
pro5v        Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168		
pro5v328     Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328		
uno          Arduino Uno						</code></pre>

<p>If you don&#39;t set it, <span class="caps">BOARD</span>_TAG defaults to uno.</p>

<p>You can, of course, continue to set F_CPU and <span class="caps">MCU </span>directly should you prefer that.</p>

<h3><span class="caps">ARDUINO</span>_LIBS</h3>

<p>Early (up to and including version 0.4) of this Makefile didn&#39;t really support this (despite claims to the contrary). Happily various kind people sorted out the problem, one of whom patched the Debian and Ubuntu version.</p>

<p>In the official <span class="caps">IDE, </span>it&#39;s enough to select the library from a menu: this puts the relevant #include into the Sketch and adds the necessarily linker tweaks too.</p>

<p>In this Makefile, you&#39;ll need to both add the #include yourself and append the directories which contain the library to the <span class="caps">ARDUINO</span>_LIBS variable. Often these will both have the same name, though it&#39;s worth noting that the #include refers to a single file, but the <span class="caps">ARDUINO</span>_LIBS entry refers to an entire directory of source files.</p>

<p>However, care is needed if the library&#39;s source files aren&#39;t in a single directory.  For example, the webserver example uses the <a href="http://www.arduino.cc/en/Reference/Ethernet">Ethernet library</a><span class="link_list"><sup>6</sup></span> and we needed to include both Ethernet and Ethernet/utility in <span class="caps">ARDUINO</span>_LIBS.</p>

<p>If you omit the .../utility library, you&#39;ll get messy looking link errors from the bowels of the Ethernet library. The <span class="caps">SPI </span>and Wire libraries are like this too!</p>

<h2>Building</h2>

<p>If you&#39;re used to Unix then this is easy:</p>

<pre><code>$ make
...</code></pre>

<p>The output is pretty verbose, but I think it should be obvious if it worked. After building you&#39;ll see a new directory has been created which contains all the object files: build-cli.</p>

<pre><code>$ $ ls -lR
total 16
-rw-r--r--   1 mjo  staff   263 12 Feb 11:06 Makefile
-rw-r--r--   1 mjo  staff  2308 12 Feb 10:57 WebServer.ino
drwxr-xr-x  28 mjo  staff   952 12 Feb 11:07 build-cli</code></pre>

<h3>build-cli</h3>

<p>Let&#39;s peek inside the build-cli directory:</p>

<pre><code>$ ls -l build-cli
total 2136	 						
-rw-r--r--  1 mjo  staff    2292 12 Feb 11:07 CDC.o		
-rw-r--r--  1 mjo  staff    2292 12 Feb 11:07 HID.o		
-rw-r--r--  1 mjo  staff   23452 12 Feb 11:07 HardwareSerial.o	
-rw-r--r--  1 mjo  staff   16008 12 Feb 11:07 IPAddress.o	
-rw-r--r--  1 mjo  staff   40012 12 Feb 11:07 Print.o		
-rw-r--r--  1 mjo  staff   21068 12 Feb 11:07 Stream.o		
-rw-r--r--  1 mjo  staff   16580 12 Feb 11:07 Tone.o		
-rw-r--r--  1 mjo  staff    2300 12 Feb 11:07 USBCore.o		
-rw-r--r--  1 mjo  staff    6048 12 Feb 11:06 WInterrupts.o	
-rw-r--r--  1 mjo  staff    7068 12 Feb 11:07 WMath.o		
-rw-r--r--  1 mjo  staff   79196 12 Feb 11:07 WString.o		
-rw-r--r--  1 mjo  staff    2329 12 Feb 10:57 WebServer.cpp	
-rw-r--r--  1 mjo  staff    1920 12 Feb 11:06 WebServer.d	
-rw-r--r--  1 mjo  staff   11324 12 Feb 11:06 WebServer.o	
-rwxr-xr-x  1 mjo  staff  193852 12 Feb 11:07 WebServer.elf
-rw-r--r--  1 mjo  staff   28572 12 Feb 11:07 WebServer.hex	
-rw-r--r--  1 mjo  staff    1920 12 Feb 11:08 depends.mk	
-rw-r--r--  1 mjo  staff  541002 12 Feb 11:07 libcore.a		
drwxr-xr-x  4 mjo  staff     136 12 Feb 10:57 libs		
-rw-r--r--  1 mjo  staff    3616 12 Feb 11:07 main.o		
&lt;-rw-r--r--  1 mjo  staff    5544 12 Feb 11:07 new.o		
-rw-r--r--  1 mjo  staff    9780 12 Feb 11:06 wiring.o		
-rw-r--r--  1 mjo  staff    7024 12 Feb 11:06 wiring_analog.o	
-rw-r--r--  1 mjo  staff    9704 12 Feb 11:06 wiring_digital.o	
-rw-r--r--  1 mjo  staff    7056 12 Feb 11:06 wiring_pulse.o	
-rw-r--r--  1 mjo  staff    5736 12 Feb 11:06 wiring_shift.o	
								
./build-cli/libs:						
total 0								
drwxr-xr-x  9 mjo  staff  306 12 Feb 11:07 Ethernet		
drwxr-xr-x  3 mjo  staff  102 12 Feb 11:07 SPI			
								
./build-cli/libs/Ethernet:					
total 392							
-rw-r--r--  1 mjo  staff  24836 12 Feb 11:07 Dhcp.o		
-rw-r--r--  1 mjo  staff  23112 12 Feb 11:07 Dns.o		
-rw-r--r--  1 mjo  staff  33008 12 Feb 11:07 Ethernet.o		
-rw-r--r--  1 mjo  staff  42000 12 Feb 11:07 EthernetClient.o	
-rw-r--r--  1 mjo  staff  19420 12 Feb 11:07 EthernetServer.o	
-rw-r--r--  1 mjo  staff  41244 12 Feb 11:07 EthernetUdp.o	
drwxr-xr-x  4 mjo  staff    136 12 Feb 11:07 utility		
								
./build-cli/libs/Ethernet/utility:				
total 152							
-rw-r--r--  1 mjo  staff  40480 12 Feb 11:07 socket.o		
-rw-r--r--  1 mjo  staff  34840 12 Feb 11:07 w5100.o		
								
./build-cli/libs/SPI:						
total 16							
-rw-r--r--  1 mjo  staff  6812 12 Feb 11:07 SPI.o		</code></pre>

<p>Most of the files in here are object files for the wiring library. What about the others ?</p>

<dl>
<dt>WebServer.cpp</dt>
<dd>This is the .pde sketch file with a small main program prepended and a suitable #include prepended.</dd>
<dt>WebServer.d</dt>
<dd>This tracks the dependencies used by WebServer.pde</dd>
<dt>WebServer.elf</dt>
<dd>This is executable produced by the linker</dd>
<dt>WebServer.hex</dt>
<dd>This is a hex dump of (the code part) of the executable  in a format understood by the Arduino&#39;s bootloader.</dd>
<dt>WebServer.o</dt>
<dd>The object file we got by compiling WebServer.cpp.</dd>
<dt>depends.mk</dt>
<dd>A single file containing all the dependency relations  (it&#39;s the concatentation of all the .d files).</dd>
<dt>libcore.a</dt>
<dd>Rather than link all the system supplied objects directly,  we build them into this library first, then link against it.</dd>
</dl>


<h2>Uploading code</h2>

<p>This is easy:</p>

<pre><code>$ make upload</code></pre>

<h2>Uploading via <span class="caps">ISP</span></h2>

<p>If you&#39;re using target hardware which doesn&#39;t have a bootloader then you might want to use <span class="caps">ISP </span>to upload the code. Though you&#39;ll obviously need some extra hardware to do this.</p>

<p>Assuming that avrdude supports your programmer though, you&#39;ll only need to make a few changes to the Makefile to tell avrdude where it can find the programmer and how to talk to it:</p>

<pre><code>ISP_PORT         = /dev/ttyACM0
ISP_PROG         = -c stk500v2</code></pre>

<p>Then to upload:</p>

<pre><code>$ make ispload</code></pre>

<h3>Fuses</h3>

<p>You might need to change the fuse settings when programming, though some care needs to be taken here or you might irreversibly damage the chip.</p>

<p>Normally the fuse settings are chosen from the boards.txt file to match the value of <span class="caps">BOARD</span>_TAG (assuming you&#39;re running version 0.6 or higher), but you can set them yourself:</p>

<pre><code>ISP_LOCK_FUSE_PRE  = 0x3f
ISP_LOCK_FUSE_POST = 0xcf
ISP_HIGH_FUSE      = 0xdf
ISP_LOW_FUSE       = 0xff
ISP_EXT_FUSE       = 0x01
</code></pre>

<h2>Growing the project</h2>

<p>There a couple of obvious things to do now. You might want to edit the sketch. That&#39;s easy: just edit the .ino file and run make again.</p>

<p>Alternatively you might want to add some more source files to the project. That&#39;s easy too: the Makefile understands C, C++ and assembler files in the source directory (with .c, .cpp, and .s extensions). Everything <strong>should</strong> just work.</p>



<h2>Wiring-less development</h2>

<p>Finally you might want to develop code which isn&#39;t linked against the Wiring library. There&#39;s some scope for this: just set NO_CORE in the Makefile e.g.</p>

<pre><code>NO_CORE = 1</code></pre>

<h2>Bugs and problems</h2>

<ul>
<li>The Makefile isn&#39;t very elegant.</li>
<li>When compiling the sketch file, the compiler actually sees the .cpp   file derived from it. Accordingly the line numbers of any errors   will be wrong (but not by that much).</li>
<li>The Makefile doesn&#39;t do some of the things that the Makefile   distributed with the Arduino software does e.g. generating <span class="caps">COFF   </span>files. I worry that some of these might be important.</li>
<li>This hasn&#39;t been used very much yet, even by me. I&#39;m writing this   now as much for my benefit as anyone else&#39;s, though I&#39;d be delighted   to know if anyone else finds it useful.</li>
</ul>

<h2>Changelog</h2>

<h3>2010-05-21, <a href="http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.3.tar.gz">version 0.3</a><span class="link_list"><sup>7</sup></span></h3>

<ul>
<li>Tidied up the licensing, making it clear that it&#39;s released under <span class="caps">LGPL</span> 2.1.</li>
<li><a href="http://hands.com/~phil/">Philip Hands</a><span class="link_list"><sup>8</sup></span> sent me some code to reset the   Arduino by dropping <span class="caps">DTR </span>for 100ms, and I added it.</li>
<li>Tweaked the Makefile to handle version 0018 of the Arduino software   which now includes main.cpp. Accordingly we don&#39;t need to&mdash;and   indeed must not&mdash;add main.cxx to the .pde sketch file. The paths   seem to have changed a bit too.</li>
</ul>

<h3>2010-05-24, <a href="http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.4.tar.gz">version 0.4</a><span class="link_list"><sup>9</sup></span></h3>

<ul>
<li>Tweaked rules for the reset target on Philip Hands&#39; advice.</li>
</ul>

<h3>2011-06-23, <a href="http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.5.tar.gz">version 0.5</a><span class="link_list"><sup>10</sup></span></h3>

<ul>
<li>Imported changes from Debian/Ubuntu, which incorporate a patch from   Stefan Tomanek so that libraries would be compiled too.</li>
</ul>

<p>Note: Many other people sent me similar patches, but I didn&#39;t get around to using them. In the end, I took the patch from Debian and Ubuntu: there seems merit in not forking the code and using a tested version. So, thanks and apologies to Nick Andrew, Leandro Coletto Biazon, Thibaud Chupin, Craig Hollabaugh, Johannes H. Jensen, Fabien Le Lez, Craig Leres, and Mark Sproul.</p>

<h3>2011-06-23, <a href="http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.6.tar.gz">version 0.6</a><span class="link_list"><sup>11</sup></span></h3>

<ul>
<li>Added ard-parse-boards. Mark Sproul suggested doing something like   this ages ago, but I&#39;ve only recently looked at it in detail.</li>
<li>Fabien Le Lez reported that one needs to link with -lc to avoid    <a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1290294587">linker errors.</a><span class="link_list"><sup>12</sup></span></li>
</ul>

<h3>Unreleased, <a href="http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.7.tar.gz">version 0.7</a><span class="link_list"><sup>13</sup></span></h3>

<ul>
<li>Added -lm to the linker options, and -F to stty.</li>
</ul>

<h3>2012-02-12, <a href="http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.8.tar.gz">version 0.8</a><span class="link_list"><sup>14</sup></span></h3>

<ul>
<li>Patches for version 1.0 of the Arduino <span class="caps">IDE.</span> Older versions might   still work, but I&#39;ve not tested it.</li>
<li>A change to the build process: rather than link all the system   objects directly into the executable, bundle them in a library   first. This should make the final executable smaller.</li>
<li>If <span class="caps">TARGET </span>isn&#39;t explicitly set, default to the current directory   name. Thanks to Daniele Vergini for this patch.</li>
<li>Add support for .c files in system libraries: Dirk-Willem van Gulik   and Evan Goldenberg both reported this and provided patches in the   same spirit.</li>
<li>Added a size target as suggested by Alex Satrapa.</li>
</ul>

<h2>Similar work</h2>

<p>It&#39;s not a derivative of this, but Alan Burlison has written <a href="http://bleaklow.com/2010/06/04/a_makefile_for_arduino_sketches.html">a similar thing.</a><span class="link_list"><sup>15</sup></span></p>

<p>Alan&#39;s Makefile was used in <a href="http://pragprog.com/magazines/2011-04/advanced-arduino-hacking">a Pragmatic Programmer&#39;s article.</a><span class="link_list"><sup>16</sup></span> </p>
        <div id="link_list">
          <h2>References</h2>
          <ul><li>1. http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.8.tar.gz</li><li>2. http://www.arduino.cc/</li><li>3. http://arduino.cc/en/Hacking/HomePage</li><li>4. http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.8.tar.gz</li><li>5. http://arduino.cc/en/Tutorial/WebServer</li><li>6. http://www.arduino.cc/en/Reference/Ethernet</li><li>7. http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.3.tar.gz</li><li>8. http://hands.com/~phil/</li><li>9. http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.4.tar.gz</li><li>10. http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.5.tar.gz</li><li>11. http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.6.tar.gz</li><li>12. http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1290294587</li><li>13. http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.7.tar.gz</li><li>14. http://mjo.tc/atelier/2009/02/acli/arduino-mk_0.8.tar.gz</li><li>15. http://bleaklow.com/2010/06/04/a_makefile_for_arduino_sketches.html</li><li>16. http://pragprog.com/magazines/2011-04/advanced-arduino-hacking</li></ul>
        </div>      </div>
           
      <div id="sidebar">
        <div class="listcontainer">
          <h2><a href="../../index/index.html">Martin's Atelier</a></h2>
          <div id="subscribe"><p><a href="../../feed.atom"><img src="../../atom.png" alt="[ Atom Feed ]" title="Atom Feed" /></a></p></div>
        </div>
        
        
        <div class="listcontainer">        
          <h3>Related Articles</h3>
          <ul>
            
            <li><a href="../03/aarduino.html">The AArduino</a><br/>Martin Oldfield, 22 Jun 2011</li>
            
            <li><a href="olimex-avrdude-mac.html">MacOS X and the Olimex AVR-ISP500</a><br/>Martin Oldfield, 22 Jun 2011</li>
            
            <li><a href="avrdude-cookbook.html">Avrdude Cookbook</a><br/>Martin Oldfield, 16 Jun 2010</li>
            
          </ul>
        </div>
        
  
        
        <div class="listcontainer">        
          <h3><a href="../../index/st_subject.html">Related Subjects</a></h3>
          <ul>
            
            <li><a href="../../index/t_Arduino.html">Arduino</a></li>
            
            <li><a href="../../index/t_command line.html">command line</a></li>
            
            <li><a href="../../index/t_Makefile.html">Makefile</a></li>
            
          </ul>
        </div>
        

        
        <div class="listcontainer">        
          <h3><a href="../../index/index.html">Other Articles</a></h3>
          <ul>
            
            <li><a href="../../2012/02/tf930_macos.html">The TTi TF930 and MacOS</a><br/>Martin Oldfield, 19 Feb 2012</li>
            
            <li><a href="../../2008/08/logitech.html">Replacing a Logitech Mouse Button</a><br/>Martin Oldfield, 07 Feb 2012</li>
            
            <li><a href="../01/london_food.html">Places to eat in London</a><br/>Martin Oldfield, 07 Feb 2012</li>
            
            <li><a href="../01/paris_food.html">Places to eat in Paris</a><br/>Martin Oldfield, 06 Nov 2011</li>
            
            <li><a href="../01/paris_drink.html">Places to drink in Paris</a><br/>Martin Oldfield, 06 Nov 2011</li>
            
            <li><a href="../../2011/08/intervalometer.html">An Intervalometer</a><br/>Martin Oldfield, 23 Aug 2011</li>
            
            <li><a href="../../2011/08/timelapse.html">Time-lapse photography</a><br/>Martin Oldfield, 13 Aug 2011</li>
            
            <li><a href="../../2011/03/xcode4-perl.html">Perl and Xcode 4</a><br/>Martin Oldfield, 22 Jun 2011</li>
            
            <li>...</li>
          </ul>
        </div>
        

        
        <div class="lastlistcontainer">        
	  <h3>Bookmark this article</h3>
        <ul class="social">
	  <li><g:plusone count="false"></g:plusone></li>
	  
          <li><a href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fmjo.tc%2Fatelier%2F2009%2F02%2Farduino-cli.html" title="Facebook"><img src="../../social/facebook.png" alt="[ facebook ]"/></a></li>
          
          <li><a href="http://del.icio.us/post?url=http%3A%2F%2Fmjo.tc%2Fatelier%2F2009%2F02%2Farduino-cli.html&title=Arduino+from+the+command+line" title="Delicious"><img src="../../social/delicious.png" alt="[ delicious ]"/></a></li>
          
          <li><a href="http://digg.com/submit?url=http%3A%2F%2Fmjo.tc%2Fatelier%2F2009%2F02%2Farduino-cli.html&title=Arduino+from+the+command+line" title="Digg"><img src="../../social/digg.png" alt="[ digg ]"/></a></li>
          
          <li><a href="http://reddit.com/submit?url=http%3A%2F%2Fmjo.tc%2Fatelier%2F2009%2F02%2Farduino-cli.html&title=Arduino+from+the+command+line" title="Reddit"><img src="../../social/reddit.png" alt="[ reddit ]"/></a></li>
          
          <li><a href="http://www.stumbleupon.com?url=http%3A%2F%2Fmjo.tc%2Fatelier%2F2009%2F02%2Farduino-cli.html&title=Arduino+from+the+command+line" title="Stumbleupon"><img src="../../social/stumbleupon.png" alt="[ stumbleupon ]"/></a></li>
          
        </ul>

        </div>

        

        </div>

        <div id="footer">
          Revised by Martin Oldfield on 12 Feb 2012, original version 17 Feb 2009.<br/>
          Contact: Martin Oldfield, ex-atelier@mjo.tc<br/>
          This work is available under the <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>, or the <a href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">LGPL</a> version 2.1 or later.
       </div>

        </div>
        
    </div>
    <script src="http://www.google-analytics.com/urchin.js"
    type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-567180-1";
    urchinTracker();
    </script>
    <script type="text/javascript">
  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
    </script>
  </body>
</html>