Get code back out of Arduino


Here's the problem: my Arduino IDE (0018) crashed while editing a .pde file. after reopening, the file was filled with zeros (\0). but the last version of my code is still on the arduino (Atmega168). Is there a way to download and decompile the code from the chip?


This is asked about once a week. The short answer is that the hex code is retrievable, but that no one has written a decompiler to turn the hex code back into C/C++ code.

The best you could do is to turn the hex code into assembler.
However turning assembler back into C is actually imposable because it is a one way algorithm. That is there is more than one way in C to get a specific sequence of assembler instructions. Therefore when going the other way which way do you choose.
Even if that were possible then your descriptive variable names would have left no trace in the code.

thanks for this fast answer...

might be too late in this case, but uploading puts a whole bunch of files in a temp/build###### dir including the .cpp. Closing the IDE clears these BUT crashing it doesn't (allways). Feel lucky - have a look.