Go Down

Topic: Retrieve a sketch from an Arduino (Read 6745 times) previous topic - next topic

HoMeR

Hi,

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.....

Thanks !

pluggy

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........
http://pluggy.is-a-geek.com/index.html

mowcius

Try using the search bar.

The simple answer is no - if you want the complex answer then I and many others have written it many times - go look for it.

floresta

Quote
Compilation is a one way process, Microsoft's business model depends on it........

Not that I want to defend Microsoft's business model - but I don't think you can pin this one on them.

Don

pluggy

I don't hold Microsoft responsible for compiling being a one way process. but they do take advantage of the fact.  Dyed in the wool Linux nerd here ;)
http://pluggy.is-a-geek.com/index.html

Nishant_Sood

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.
"Real Men can Accomplish  Anything"

- skype : nishants5  
ਫ਼ਤੇਹ ਕਰੁਂ!
www.winacro.com

floresta


... 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?

Don

Nishant_Sood



  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.
"Real Men can Accomplish  Anything"

- skype : nishants5  
ਫ਼ਤੇਹ ਕਰੁਂ!
www.winacro.com

floresta

Quote
He said he needs to "Replicate the same stuff" over the newer chips he buys

And where did he say this?

Don

Nishant_Sood



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.
"Real Men can Accomplish  Anything"

- skype : nishants5  
ਫ਼ਤੇਹ ਕਰੁਂ!
www.winacro.com

floresta

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.

Don

Nishant_Sood

Why don't you just help him for which you should be there irrespective of Quoting my facts
"Real Men can Accomplish  Anything"

- skype : nishants5  
ਫ਼ਤੇਹ ਕਰੁਂ!
www.winacro.com

floresta

Quote
Why don't you just help him ...

Because there is nothing that can be done.  This was correctly stated in the first two replies.  

Don

mrtaylor

#13
Feb 24, 2011, 02:23 am Last Edit: Feb 24, 2011, 06:02 pm by mrtaylor Reason: 1
@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.


floresta

#14
Feb 24, 2011, 10:48 pm Last Edit: Feb 24, 2011, 10:51 pm by floresta Reason: 1
@mrtaylor

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.

Don

Go Up