A short question:

I wonder weather I can program an AVR chip (ATMega328, ATMega664, ATMega1284, ATTiny etc.) using the Arduino IDE, via ISP, without needing to bootload first.

Does programming via ISP clear the bootload, if installed previously in the chip?


1 Answer 1


As Ignacio mentioned, using ISP does not require a bootloader, however, it is also very nearly mutually exclusive with retaining one.

Does programming via ISP clear the bootload, if installed previously in the chip?

Indeed, it does. The ISP interface on the ATmega cannot erase individual pages but only the entire chip. This is distinct from the SPM instruction used by a bootloader running on the chip itself, which can perform a partial erase. It is also distinct from the ATxmega, which does apparently offer an ISP page erase capability.

So in order to end up with both a bootloader and sketch on the ATmega, you would need to erase the full chip, and then load both the bootloader and the sketch, either in a unified hex file or by loading one and then the other to distinct already-blank memory regions while using the -D option to tell avrdude not to perform an automatic erase.

I do not believe the the Arduino IDE supports this, rather its menu option to program a sketch via a programmer is intended to set up a chip for operation with a sketch alone and no bootloader. There does not appear to be any way at GUI-level to configure it to do otherwise.

Someone determined enough could probably craft a customized board configuration that built a functional bootloader into every sketch (or merged or additionally programmed a pre-built one), allowing one shot installation of both an operable sketch and an operable bootloader that could field upgrade it. However, the Arduino IDE would be a poor choice for production programming...

  • Chris Stratton is quite right. As I noted under the question, this was also asked on the Arduino forum a day or two ago. The ICSP process can only erase the whole chip. You can't therefore keep the bootloader and replace the code, or even keep the code and replace the bootloader. A unified file is one approach (production Arduinos would be shipped that way). However re-installing the bootloader afterwards, when wanted, is quite simple.
    – Nick Gammon
    Jun 12, 2016 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.