I try and put my Arduino specific stuff on the forum somewhere to aid in others finding it with Search. But sometimes I forget to cross-post articles.
Back in June, I wrote an Instructables article
http://www.instructables.com/id/Copy-n-Paste-Arduino-Firmware/# and then in July I answered a forum member's question
Any command line tool to upload my own hex compiled elsewhere to my uno? - #3 by mrburnette - Microcontrollers - Arduino Forum
but I never got around to creating a new thread with the subject to assist in forum searches. Until today.
If you have an AVR-ISP device, you essentially have a chip copy machine. While we think about using the ISP for downloading (burning/flashing) the uC, the hardware interface is also capable of reading the information. Nick Gammon makes good use of this capability in his Board Detector Sketch:
But, you can essentially create uC firmware backups files and duplicate ATmel chips without using the GUI environment. Below is my Windows Vista scripts which duplicates an Atmega328.
Note: The AVRDUDE specific information derived from various sources; that is, many people helped in this development and therefore it should be considered a shared effort by many. My part is just in putting it all in one place/file.
REM
prompt $G
ECHO OFF
CLS
ECHO.
ECHO BATCH COPY ATMEGA328P-PU VIA ARDUINO-ISP ON COM9
CD C:\Program Files\Arduino_105\hardware\tools\avr\bin
ECHO ENSURE MASTER CHIP IS IN THE READER
ECHO CTRL+C to abort OR PRESS Any key to begin copy...
ECHO.
pause >nul
ECHO Creating hexadecimal binary files of ATmel328P contents...
>stdout.log 2>&1 (
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U flash:r:%temp%\backup_flash.hex:i
ECHO flash has been sAVED to backup_flash.hex
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U eeprom:r:%temp%\backup_eeprom.hex:i
ECHO eeprom has been SAVED to backup_eerpom.hex
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U hfuse:r:%temp%\backup_hfuse.hex:i
ECHO hfuse has been SAVED to backup_hfuse.hex
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U lfuse:r:%temp%\backup_lfuse.hex:i
ECHO lfuse has been SAVED to backup_lfuse.hex
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U efuse:r:%temp%\backup_efuse.hex:i
ECHO efuse has been SAVED to backup_efuse.hex
)
ECHO Hexadecimal files created.
ECHO.
CD C:\Program Files\Arduino_105\hardware\tools\avr\bin
ECHO INSERT THE NEW CHIP now!
ECHO PRESS Any key to write new chip...
pause >nul
REM Note that the path cannot contain the drive letter "C:" so you cannot use %temp% as previously
REM Reference:http://savannah.nongnu.org/bugs/index.php Bug report #39230
REM.
>>stdout.log 2>&1 (
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U flash:w:\Users\owner\AppData\Local\Temp\backup_flash.hex
ECHO backup_flash.hex WRITTEN
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U eeprom:w:\Users\owner\AppData\Local\Temp\backup_eeprom.hex
ECHO backup_eeprom.hex WRITTEN
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U hfuse:w:\Users\owner\AppData\Local\Temp\backup_hfuse.hex
ECHO hfuse WRITTEN
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U lfuse:w:\Users\owner\AppData\Local\Temp\backup_lfuse.hex
ECHO lfuse WRITTEN
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U efuse:w:\Users\owner\AppData\Local\Temp\backup_efuse.hex
ECHO efuse WRITTEN ... this may change from 05 to 07 with BOD being disabled by AVRDUDE
)
ECHO.
ECHO Chip duplication and verification is complete.
ECHO Starting Notepad editor to display log file.
start notepad C:\Program Files\Arduino_105\hardware\tools\avr\bin\stdout.log
ECHO.
ECHO Press Any key to close this window...
pause >nul
This script allows unlimited copies from the 'left over" files from the above script:
REM Execute this for 2nd throgh n copies IMMEDIATELY after 1st copy
PROMPT $G
ECHO OFF
CLS
CD C:\Program Files\Arduino_105\hardware\tools\avr\bin
ECHO INSERT THE NEW CHIP INTO ARDUINO ISP PROGRAMMER
ECHO PRESS Any key to write new chip (CTRL+C to abort)
ECHO ...
PAUSE >nul
REM Paste 328: Note that the path cannot contain the drive letter "C:" so you cannot use %temp% as previously
REM Reference:http://savannah.nongnu.org/bugs/index.php Bug report #39230
REM.
>stdout.log 2>&1 (
DIR %temp%\*.hex
ECHO ATmel328P-PU duplication is beginning now...
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U flash:w:\Users\owner\AppData\Local\Temp\backup_flash.hex
ECHO flash WRITTEN
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U eeprom:w:\Users\owner\AppData\Local\Temp\backup_eeprom.hex
ECHO eeprom WRITTEN
REM high_fuses=0xDA
REM REM avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U hfuse:w:0xDA:m
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U hfuse:w:\Users\owner\AppData\Local\Temp\backup_hfuse.hex
ECHO hfuse WRITTEN
REM low_fuses=0xE2
REM avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U lfuse:w:0xE2:m
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U lfuse:w:\Users\owner\AppData\Local\Temp\backup_lfuse.hex
ECHO lfuse WRITTEN
REM extended_fuses=0x05
REM avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U efuse:w:0x05:m
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U efuse:w:\Users\owner\AppData\Local\Temp\backup_efuse.hex
ECHO efuse WRITTEN
)
REM.
REM Chip duplication is complete... starting display of log file.
start notepad C:\Program Files\Arduino_105\hardware\tools\avr\bin\stdout.log
ECHO.
ECHO Press Any key to close this window...
PAUSE >nul
REMEMBER: When working with Windows, different versions: XP, Vista, Win7, Win8 mucks around with the directory locations. You will likely need to edit the scripts to match your specific environment and OS version.
Ray