Ok, I’ve googled, I’ve read, I’ve learnt, and I’ve experimented, but still no luck.
Basically it seems this is a known issue, but with no known fix that will work in all occurrences. It seems to effect larger sketches, and those that use interrupts, it’s got something to do with the ‘linker’ (getting well past the borders of my knowledge here) and something to do with the way code gets distributed in memory. Some developers have had success by installing later version of code, re-arranging #include statements, or installing newer version of avr.
Here’s what I’ve tried,
Firstly, I tried altering the order that my libraries are listed in – didn’t make any difference.
Then I re-tested (compiled, uploaded and ran) each of the 30 plus libraries the sketch calls. No problems with any of them.
Then I tried all the later versions up to 1.0.4, all give the same symptoms.
Next, I’ve tried the solution suggested in this thread http://arduino.cc/forum/index.php?topic=140667.0
(basically I added some extra lines to the top of hardware.h) the results started off looking promising, the code compiled without error, claimed to upload without error, but then the sketch just didn’t run. (I subsequently found other posts suggesting this fix didn’t work)
Then I tried the fix proposed here …http://arduino.cc/forum/index.php/topic,37965.msg281176.html#msg281176 basically this suggested downloading a new version of WinAVR (version 20100110) and moving the file avrdude.conf. I tried this, the code compiles fine, claims to upload (i.e. displays the message ‘Done uploading’) but also displays the error….
avrdude: Can't find programmer id "wiring"
Valid programmers are:
c2n232i = serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts [C:\all_apps\arduino-1.0.4\hardware/tools/avr/etc/avrdude.conf:876]
dasa3 = serial port banging, reset=!dtr sck=rts mosi=txd miso=cts [C:\all_apps\arduino-1.0.4\hardware/tools/avr/etc/avrdude.conf:863]
(plus a long list of more valid programmers)
I then tried improvising, and copied over the original version of avrdude.conf (as downloaded with version 1.0.4). This too compiled ok, and claimed to download, but then produced the error…
error at C:\all_apps\arduino-1.0.4\hardware/tools/avr/etc/avrdude.conf:332 unrecognized character: "w"
I found some other posts suggesting that the error might be related to the addition of the ‘—relaxer’ flag when Arduino was upgraded to 1.0.1, but couldn’t actually find a proposed fix or workaround.