Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

How to burn bootloader *and* sketch in one go? [SOLVED]
Moderators: adafruit_support_bill, adafruit

How to burn bootloader *and* sketch in one go? [SOLVED]

by vputz on Sun Jan 27, 2013 10:31 am

I've asked on the Arduino fora as well, but I figured here would be good, and I'm sure it's been asked before but I sure haven't seen the answer (not sure what exactly to search for).

I'm making a little device which is an interface between old serial gaming devices and a USB port using V-USB (a "hardware driver" if you will). I want it to come flashed with a "basic joystick" sketch so people can get some plug-and-play joy, but I also want it flashed with the Arduino bootloader so that users can tinker and upload their own sketches for mouse/keyboard emulation etc.

I can see how to use both the Arduino environment and avrdude to burn the bootloader, and I can see how to burn a sketch. What I can't see is how to burn both the bootloader and a sketch in one go.

I've got a ZIF-socket minimalist board and a heap of chips, and while I'm waiting for the PCBs to come back for my beta testers, I've got, well, time to burn. Halp?
vputz
 
Posts: 61
Joined: Mon May 03, 2010 5:43 am

Re: How to burn bootloader *and* sketch in one go? [SOLVED]

by vputz on Sun Feb 03, 2013 11:16 am

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

Code: Select all | TOGGLE FULL SIZE
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

Code: Select all | TOGGLE FULL SIZE
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.
vputz
 
Posts: 61
Joined: Mon May 03, 2010 5:43 am