Burn bootloader and sketch in one go? [SOLVED]

Tried the Arduino and Adafruit fora; going for three :slight_smile:

I remember taking a class at Sparkfun and watching them burn a sketch onto a pro or simon kit using avrdude. So I’ve gotten that far myself with a USBTiny and a minimalist ZIF socket board.

But for an upcoming project (an interface between an old serial gaming device and USB HID, like a hardware driver) I want to be able to ship with a preloaded sketch so people who assemble it can plug and play without additional steps, but also with the bootloader preloaded so that they can upload new sketches with the Arduino environment using a FTDI cable rather than forcing them to get an ISP.

Is there a way to flash both at the same time in one pass using an ISP like USBTiny? I’m assuming it means making one big .hex file, but I’m unclear how to do that.

If you burn the bootloader to your master copy, then upload the sketch like normal, you should be able to use avrdude to get the contents of the chip back out, and then use that binary to flash the rest of your chips. (see http://www.nongnu.org/avrdude/user-manu … nvocations)

That said, YMMV, and I haven’t tried this.

MMMV, and you may not have tried it, but it’s the only useful response I’ve gotten on three different fora. There may be a “better way” but I’m sure going to try this this weekend. Thanks!

On AVRfreaks.net, this topic comes up a lot. So there’s info to be had with a search there.

Solved, by the option of reading the full chip and writing it (backup/restore) rather than properly “uploading the software”.

avrdude -C ..\etc\avrdude.conf -p m328p -c usbtiny -U flash:r:backup_flash.bin:r
avrdude -C ..\etc\avrdude.conf -p m328p -c usbtiny -U eeprom:r:backup_eeprom.bin:r
avrdude -C ..\etc\avrdude.conf -p m328p -c usbtiny -U hfuse:r:backup_hfuse.bin:r
avrdude -C ..\etc\avrdude.conf -p m328p -c usbtiny -U lfuse:r:backup_lfuse.bin:r
avrdude -C ..\etc\avrdude.conf -p m328p -c usbtiny -U efuse:r:backup_efuse.bin:r

and then swapping chips and doing

avrdude -C ..\etc\avrdude.conf -p m328p -c usbtiny -U flash:w:backup_flash.bin
avrdude -C ..\etc\avrdude.conf -p m328p -c usbtiny -U eeprom:w:backup_eeprom.bin
avrdude -C ..\etc\avrdude.conf -p m328p -c usbtiny -U hfuse:w:backup_hfuse.bin
avrdude -C ..\etc\avrdude.conf -p m328p -c usbtiny -U lfuse:w:backup_lfuse.bin
avrdude -C ..\etc\avrdude.conf -p m328p -c usbtiny -U efuse:w:backup_efuse.bin

It didn’t seem to work with just “flash”, so I added everything else. Perhaps overkill, but it works.

Hi all,

I have successfully made my own arduino using Atmega328, but I problem I am facing that I have to bootload the atmega328 chip every time when I have to update the sketch. Can anyone suggest solution for this?

AVR Dudess. Make one the normal way and then Copy the whole chip and upload with a nice GUI. You can save different presets to make it easy.