Go Down

Topic: Getting the contents of Arduino's flash memory back (Read 60 times) previous topic - next topic

Christina7234

I have a code burned on Arduino uno and I want to get the hex file of this code back?!

How can I make that ?!

Anyone can help me ???

pert

First, we're going to do a dummy upload in the Arduino IDE in order to get it to help us generate the avrdude command

  • Plug your Uno into your computer
  • Select the Uno's port from the Arduino IDE's Tools > Port menu
  • Tools > Board > Uno
  • Unplug your Uno from your computer
  • File > Preferences
  • Check the box next to Show verbose output during > upload.
  • Click "OK".
  • Sketch > Upload
  • Wait for the upload to fail
  • Scroll up the black console window at the bottom of the Arduino IDE window until you see the command that was generated for the upload.
  • Select the full text of the upload command.
  • Press Ctrl + C. This will copy the upload command to the clipboard.



Next, you need to modify the upload command to read the hex file out of the Uno:

Start a text editor program.

In the text editor window, press "Ctrl + V". This will paste the command into the text editor.

The end of the command will look something like this:
Code: [Select]
-D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_696871/sketch_apr02b.ino.hex:i
That is the part of the command that tells it to write. So you need to replace that with the command that tells it to read:
Code: [Select]
-Uflash:r:readfile.hex:i
That will cause the read file to be named "readfile.hex", which will be saved to whichever folder you run the command from.

If the paths in the command contain spaces, wrap the paths in quotes.

Plug your Uno into your computer.

Copy and paste the command to the command line and run it.

Go Up