I'm trying to back up the program on an arduino nano. Sadly the original developer of the sketch is no longer with us, and the source code is believed to have been deleted.
I found this thread showing how to accomplish this with avrdude:
I have two other nanos to use as test beds. I have already used avrdude to copy the program as hex off of one of those nanos. But I have noticed that the hex file that was copied off is much bigger than the compiled sketch hex that I put onto it.
Is this a problem? Do I have to transform the read hex before trying to write it?
Also, I could not find any information on if there is any risk to doing this. Is there?
And finally, I don't know which of the nanos are genuine and which are clones. Is there any issue if they don't exactly match each other?
There are two formats, the first one has 16 data bytes in a row and the second one has 8 data bytes on a row.
For each you have to add some additional stuf like address and checksum; there is some more.
Hence the size of the versions will differ. I think the IDE generates a hex file with 16 data bytes per row and avrdude reads back in 8 databytes per row.
No risk.
Processors need to be the same, serial-to-usb converter does not matter.
In addition to what @sterretje has already noted, it's very likely that the downloaded hex file is a read of the entire 32K flash space, not just whatever the original program uses.
The upload reported an error - After writing the hex, avrdude read the hex back off the nano and compared it to the upload, and found differences - 4 lines near the end that were mostly all FFs when read back, but were not in the uploaded hex (the one I read off of the other nano)
However the program did work
Error output from avrdude:
Warning: flash verification mismatch
device 0xff != input 0x09 at addr 0x7f00 (error)
device 0xff != input 0x02 at addr 0x7f01 (error)
device 0xff != input 0x10 at addr 0x7f02 (error)
device 0xff != input 0x30 at addr 0x7f03 (error)
device 0xff != input 0x91 at addr 0x7f04 (error)
device 0xff != input 0xf4 at addr 0x7f05 (error)
device 0xff != input 0x00 at addr 0x7f06 (error)
device 0xff != input 0x91 at addr 0x7f07 (error)
device 0xff != input 0x57 at addr 0x7f08 (error)
device 0xff != input 0x00 at addr 0x7f09 (error)
suppressing further verification errors
Error: flash verification mismatch
And, the nano I manually uploaded to seems to have been damaged. All uploads now report failure at the verification step, and the program I manually wrote with avrdude remains on it, so it's like the upload fails to actually updater the flash memory at all.
Did I break the arduino bootloader on the chip or something?