3
\$\begingroup\$

Does the Arduino chip get wiped of any (uploaded) code when you press the reset button?

and

Can you retrieve the code that is currently on the chip?

asked Nov 11, 2009 at 10:59
\$\endgroup\$

3 Answers 3

5
\$\begingroup\$

No, nothing gets wiped and yes you can read the code and data currently on the chip. You do lose the contents of RAM when the chip loses power. Avrdude is a useful program that will allow you to read and write the chip contents. The Arduino IDE uses avrdude to program the chip. Lady Ada has a very good tutorial on Avrdude - indeed her tutorials are all very good.

answered Nov 11, 2009 at 11:08
\$\endgroup\$
1
  • \$\begingroup\$ You can recover the hex, and in theory you can disassemble the hex to assembly (I don't know of any toolkits that will do this for an AVR off-hand, but they probably exist). Getting it back to the original sketch, of course, is pretty much impossible because of how compilers work. You may be able to recover a functionally equivalent sketch, if you can find the tools to do so, but it would likely look VERY different from the original and there's no guarantee it would be able to recompile (size, memory limitations). \$\endgroup\$ Commented Nov 11, 2009 at 14:16
1
\$\begingroup\$

You can retrieve the compiled hex code from the chip (like an exe file for the microcontroller), but reconstructing the original Arduino sketch from it is nearly impossible.

answered Nov 11, 2009 at 11:32
\$\endgroup\$
4
  • \$\begingroup\$ I assume you can convert the hex to assembler though. \$\endgroup\$ Commented Nov 11, 2009 at 12:22
  • 2
    \$\begingroup\$ AVRStudio includes a functional disassembler. Open the HEX file (file->open), select "AVR Simulator" and the correct chip, then open the disassembler (file->disassembler). \$\endgroup\$ Commented Nov 11, 2009 at 14:36
  • \$\begingroup\$ Can you do this on non-AVR chips like Pics for instance? \$\endgroup\$ Commented Nov 11, 2009 at 20:58
  • \$\begingroup\$ Yes, MPlab includes a disassembler view in the memory window. Start a new project, import a hex file, then "view->program memory", then choose "symbolic" or "machine" as the view type. It's also not perfect, but if you're an assembly programmer, it's usable. \$\endgroup\$ Commented Nov 12, 2009 at 0:20
0
\$\begingroup\$

Nothing gets wiped on reset. To answer your first question.

Whether the code, or the eeprom data can be retrieved depends on the fuse settings. These determine if the flash and/or eeprom can be read.

answered Jul 24, 2019 at 21:31
\$\endgroup\$
1
  • \$\begingroup\$ The Arduino bootloader if present and operable can be used to read out contents regardless of protection settings. Some manipulations of the SPI lines while reset is low can accidentally happen on an ISP sequence erasing or at least corrupting contents - seems far-fetched but have seen it repeatedly. \$\endgroup\$ Commented Jul 24, 2019 at 23:14

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.