I have an Arduino with a sketch that works great. I want to use it for another project but I wouldn't want to lose the sketch (my original got lost in an harddrive crash).
Is there a way to get it "out" of the Arduino ? It would be a lot of work to program it again from scratch.....
Not as such. You may be able to retrieve the code as machine code so it can be reloaded. Compilation is a one way process, Microsoft's business model depends on it........
you can make a paraellel programmer or Serial Programmer(I recommend it) so you can do it in home so will definitely save you money and then use the PONYPROG's latest environment and extract the INTEL HEX out of it, this is cheapest or else use the AVR programmer to extract the program.
Nishant:
... and extract the INTEL HEX out of it...
And with the proper disassembler or a lot of work he could then come up with an uncommented assembly language version of the program code. What would he do next to accomplish his objective of retrieving his original sketch?
What would he do next to accomplish his objective of retrieving his original sketch?
Don
He said he needs to "Replicate the same stuff" over the newer chips he buys so that need to write the cumbersome program is Eliminated ,he can achieve that with the solution.
HoMeR:
I have an Arduino with a sketch that works great. I want to use it for another project but I wouldn't want to lose the sketch (my original got lost in an harddrive crash).
did you get that? He just not want to loose the actual thing in it and use it as it is currently loaded and working on it.
You don't seem to understand the concepts of quotation marks any more than you understand the concept of recovering a sketch (program). There's a big difference between recovering the object code and recovering the source code.
@HoMeR
Since you don't want to modify the original sketch here a place to start.
First I upload the example blink sketch to Arduino Uno.
(Your sketch is already uploaded, I did this for testing. DON'T DO THIS STEP )
Then I executed the following command. It copies the flash memory and writes it to a file called blink.hex
avrdude -C ./avrdude.conf -patmega328p -cstk500v1 -P /dev/ttyACM1 -Uflash:r:blink.hex:i
Then I uploaded another sketch that did not cause the led to blink. My intent was to erase the blink sketch from memory.
I then reload the blink sketch back into memory using the following command
avrdude -C ./avrdude.conf -patmega328p -cstk500v1 -P /dev/ttyACM1 -Uflash:w:blink.hex:i
It is working fine. If your sketch uses eeprom memory, read up on avrdude to see if you can copy it to a file. You will have to change some of the avrdude option to fit your system.
I repeat: There's a big difference between recovering the object code and recovering the source code. He asked about recovering his sketch which is the source code.