<?xml version="1.0"?><rss version="2.0">
<channel>
  <title>Alan&#039;s Ramblings - pragmatic programmer tag</title>
  <link>http://bleaklow.com:80/tags/pragmatic programmer/</link>
  <description>My opinions may be incorrect, but they are my own</description>
  <language>en</language>
  <copyright>Alan Burlison</copyright>
  <lastBuildDate>Wed, 29 Feb 2012 20:50:00 GMT</lastBuildDate>
  <generator>Pebble (http://pebble.sourceforge.net)</generator>
  <docs>http://backend.userland.com/rss</docs>
  <image>
    <url>http://bleaklow.com/images/misc/logo.gif</url>
    <title>Alan&#039;s Ramblings</title>
    <link>http://bleaklow.com:80/</link>
  </image>
  <item>
    <title>A mention on the Pragmatic Programmer</title>
    <link>http://bleaklow.com:80/2011/05/08/a_mention_on_the_pragmatic_programmer.html</link>
    <description>
          &lt;p&gt;
I was looking at my &lt;a href=&#034;http://www.google.com/analytics/&#034;&gt;Google Analytics&lt;/a&gt; and noticed I was getting referrals from the &lt;a href=&#034;http://www.pragprog.com&#034;&gt;Pragmatic Programmer&lt;/a&gt; site, specifically from an article in the April magazine issue entitled &lt;a href=&#034;http://www.pragprog.com/magazines/2011-04/advanced-arduino-hacking&#034;&gt;Advanced Arduino Hacking&lt;/a&gt;.  Turns out they were using my &lt;a href=&#034;/files/2010/Makefile.master&#034;&gt;Makefile.master&lt;/a&gt; as the basis of their article, which describes how to use the Arduino platform without having to use the not-very-good Arduino IDE.  OK, I suppose that&#039;s a little unfair - the IDE is clearly meant for beginners but if you are an experienced developer or are working on more complex projects it becomes very limiting very quickly, as noted in the article.
&lt;/p&gt;
&lt;p&gt;
There are a &lt;a href=&#034;http://users.jyu.fi/~mweber/software/arduino/Makefile.master&#034;&gt;number&lt;/a&gt; &lt;a href=&#034;http://code.google.com/p/arduino/issues/attachmentText?id=344&amp;aid=7568997944726479287&amp;name=Makefile.master&amp;token=aabb0d45600455086e9b95b1f977f91a&#034;&gt;of&lt;/a&gt; copies of my Makefile.master floating around, but I&#039;m updating it fairly regularly, so I recommend you grab the &lt;a href=&#034;/files/2010/Makefile.master&#034;&gt;original version&lt;/a&gt;.  Compared to the version on the PragProg site, the current version (at time of writing) has the following improvements: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The only really platform-specific parts of the Makefile are those that deal with running the serial monitor used to connect to the Arduino.  On Solaris I use &lt;a href=&#034;http://download.oracle.com/docs/cd/E19253-01/816-5165/6mbb0m9tt/index.html&#034;&gt;tip&lt;/a&gt; whereas on Linux you&#039;d probably want to use something such as &lt;a href=&#034;http://www.gnu.org/software/screen/&#034;&gt;screen&lt;/a&gt;.  I&#039;ve therefore added platform-specific sections to configure the serial monitor commands to the Makefile.master.  I don&#039;t currently have settings for MacOS, if someone wants to provide some suggestions, I&#039;ll add them in.&lt;/li&gt;
&lt;br/&gt;
&lt;li&gt;I hit a linker bug when using the &lt;a href=&#034;http://www.nongnu.org/avr-libc/user-manual/index.html&#034;&gt;avr-libc&lt;/a&gt; floating-point library, the workaround being to specify &lt;code&gt;-lm&lt;/code&gt; both first and last in the linker command-line arguments.&lt;/li&gt;
&lt;br/&gt;
&lt;li&gt;An optional &lt;code&gt;EXTRA_FLAGS&lt;/code&gt; macro that can be used to specify any additional flags that you want passed to gcc/g++.  I use this for enabling/disabling debugging, e.g. &lt;code&gt;EXTRA_FLAGS=-DDEBUG&lt;/code&gt; in my project Makefile.&lt;/li&gt;
&lt;br/&gt;
&lt;li&gt;The automatic tracking of &lt;code&gt;#include&lt;/code&gt; dependencies was being done via a separate invocation of the compiler, this has been collapsed into the main compilation step, thus halving the number of times the compiler is invoked.  If you don&#039;t know what automatic dependency checking is, there&#039;s a good explanation &lt;a href=&#034;http://mad-scientist.net/make/autodep.html&#034;&gt;here&lt;/a&gt; and also in the &lt;a href=&#034;http://www.gnu.org/software/make/manual/make.html#Automatic-Prerequisites&#034;&gt;GNU make&lt;/a&gt; documentation.&lt;/li&gt;
&lt;br/&gt;
&lt;li&gt;The generated dependency files are stored in the &lt;code&gt;build&lt;/code&gt; subdirectory of the project, but they do tend to clutter things up.  I&#039;ve therefore  moved them all into hidden (dot) files.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
One final note, the PragProg Makefile.master uses &lt;code&gt;stty -f $(PORT) hupcl&lt;/code&gt; to trigger a reset on the arduino before uploading the hex image to it.  Not only is that platform-specific, it&#039;s also unnecessary if you are using a recent-ish version of &lt;a href=&#034;http://www.nongnu.org/avrdude/&#034;&gt;avrdude&lt;/a&gt; which will do the reset for you if you specify a programmer type of &lt;code&gt;arduino&lt;/code&gt; rather than &lt;code&gt;stk500&lt;/code&gt;.
&lt;/p&gt;</description>
      <category>Arduino</category>
    <category>Tech</category>
    <comments>http://bleaklow.com:80/2011/05/08/a_mention_on_the_pragmatic_programmer.html#comments</comments>
    <guid isPermaLink="true">http://bleaklow.com:80/2011/05/08/a_mention_on_the_pragmatic_programmer.html</guid>
    <pubDate>Sun, 08 May 2011 14:01:41 GMT</pubDate>
  </item>
  </channel>
</rss>

