How can I backup a program that is currently on an arduino

I would like to save (or backup) a program that is currently on an arduino. Background: I programmed an arduino a while ago and everything worked fine (call this version 1). Now I don't have the source code anymore but I'd like to make a new program to add some functionality. I've written a new program (version 2) and I'm ready to upload and test. But I'd like to save the program that is currently on the arduino (version 1) so that I can go back to it if version 2 doesn't work out.

Please note I'm NOT trying to edit version 1, the code that is already on the arduino. I don't need any source code. just a file that I can re-upload to the arduino if version 2 isn't as good.

Thanks, Mark

maybe it’s a lame suggestion but couldn’t you just buy another ATMEGA328 with bootloader and pop off the original with the version 1 code, save it in a box?

That's not a lame suggestion. But I would prefer not to. I'd rather just have version 1 on my computer and be able to upload it if there are any problems with my new program. Thanks for the suggestion. Any others?

avrdude and AVR Studio can read fuses, lock bits etc. Can they read program memory?

Ok I just had a look, AVR Studio has a “Read flash” option in the programming window but I think it’s just to verify, there doesn’t seem to be any way of saving the results. Still that means it’s possible to read the flash memory.

avrdude has this option

-U :r|w|v:[:format]
Memory operation specification.
Multiple -U options are allowed, each request
is performed in the order specified.

It looks like that can be used.


Yes it is possible - I suggest you use the forum search tool. This question is asked about once a fortnight...