I was confused by the documentation about chip erase. Its imporant
- Erasing is important to write, unless switching bits from 1 to 0 only
- -D allows to disable it, but this is questionable because of the above
- Page erase operation is only supported by some chips like xmega
My experience was that to program an AVR chip, a bootloader must always
be part of the image and fuse bits always specified, otherwise it was
impossible to then use ISP via the programmer.
The simple explanation is that the SPM self-programming instruction
used by bootloaders do allow to erase and program individual pages.
When programming via the bootloader, -D is advised to preserve fuse
bits and the bootloader; sending small images that don't include the
bootloader then trivial, without affecting fuse bits or the bootloader.
I thus recommend adding the following to the documentation of -D:
This option is useful when flashing through bootloaders for
self-programming (the AVR SPM instruction used by avrisp bootloaders
support the update of specific individual pages).
I probably should have sent a PR for this, but failed to find the submit
feature. If anyone can update the code or submit said PR, I would be