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

USB AVR Programmer and SPI interface. Adafruit's USBtinyISP.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
vputz
 
Posts: 79
Joined: Mon May 03, 2010 5:43 am

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

Post by vputz »

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?

User avatar
vputz
 
Posts: 79
Joined: Mon May 03, 2010 5:43 am

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

Post by vputz »

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

Code: Select all

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

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.

Locked
Please be positive and constructive with your questions and comments.

Return to “USBtinyISP”