sudar/Arduino-Makefile — pull request #288 by tchebb (2014-11-07 23:57:02+00:00)
Title: Allow avrdude to erase the chip before programming during ispload

We currently pass the `-D` (do not erase) option to `avrdude` unconditionally in order to work around an Arduino Mega bootloader bug. However, this has the side-effect of breaking the `ispload` target for all non-XMEGA chips, since a write operation on these chips essentially ANDs the new program with the existing memory contents. If the memory is not first erased to contain only `0xff`, the resulting image is garbage. This patch makes it so we pass `-D` when we're using the Arduino bootloader but don't pass it when we're using ISP directly.

Note: I wasn't able to test this patch with an Arduino Mega, since I don't have one. However, it ought to generate an identical `avrdude` command line as it did before (except for switching the order of a couple arguments), so I'm as sure as I can be that it won't cause any new bugs.