Extact .hex

Hello …..
How extract .hex from Arduino UNO, to save it ?????

You can't do this via the Arduino IDE, but you can do it from the command line using the avrdude tool that comes with the Arduino IDE. The command is about the same as the upload command, except you change the -U option from a write to a read. For example, let's say your normal upload command looked like this:

C:\ArduinoIDE\arduino-1.8.7\hardware\tools\avr/bin/avrdude -CC:\ArduinoIDE\arduino-1.8.7\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM2 -b115200 -D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_418018/Blink.ino.hex:i

You would change it to this:

C:\ArduinoIDE\arduino-1.8.7\hardware\tools\avr/bin/avrdude -CC:\ArduinoIDE\arduino-1.8.7\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM2 -b115200 -D -Uflash:r:hexfile.hex:i

The "w" is changed to "r" to do a read from flash instead of a write from flash.
The "hexfile.hex" is the output filename. You can use any filename you like.

The easiest way to generate the base command is to:

  • Turn on verbose output in the Arduino IDE (File > Preferences > Show verbose output during: > upload).
  • Do an upload. It doesn't matter if the upload is successful or not. Make sure not to upload to your Uno, otherwise you'll lose the program that you want to save!
  • Scroll up the black console window at the bottom of the Arduino IDE window until you find the avrdude command generated by the Arduino IDE. Select and copy that command to the clipboard.
  • Paste the avrdude command to a text editor or the command line and make the required modifications.

AVRDUDE option documentation:

Thanks,
In hardware\tools\avr\bin, …. I have all sorts of avr-xxxxx.exe , but not "avrdude …. !!!!!?????

That's very odd. If you're using Windows, there should be a file named avrdude.exe in that folder. Which version of the Arduino IDE are you using?

You can always download AVRDUDE from the official website:
http://download.savannah.gnu.org/releases/avrdude/

Or the slightly modified version that Arduino uses:
http://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-i686-w64-mingw32.zip

I am using 1.8.7

..hardware\tools\avr\bin\avrdude.exe
It is there. I would download a fresh copy if not.
You couldn't upload sketches. See the command in the log.

OK, I have avrdude …..
But i can't used because windows ( cmd console ) don't find path:
C:\Program Files\Arduino\hardware\tools\avr\bin\avrdude.exe.
How start it ….???

  1. Use full path.
  2. Set CMD to the directory and run it.
  3. Add to the Path environment variable....

OK ….
But I don't understand the use of this program …..
I try and I have message :
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin>avrdude.exe :r :XXXX.hex
avrdude.exe: can't open config file "": Invalid argument
avrdude.exe: error reading system wide configuration file ""
Where can-I find how use it……?????

serge69:
I try and I have message :
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin>avrdude.exe :r :XXXX.hex

I can't imagine how you came up with that avrdude command. Read the instructions I provided again:

pert:
You can't do this via the Arduino IDE, but you can do it from the command line using the avrdude tool that comes with the Arduino IDE. The command is about the same as the upload command, except you change the -U option from a write to a read. For example, let's say your normal upload command looked like this:

C:\ArduinoIDE\arduino-1.8.7\hardware\tools\avr/bin/avrdude -CC:\ArduinoIDE\arduino-1.8.7\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM2 -b115200 -D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_418018/Blink.ino.hex:i

You would change it to this:

C:\ArduinoIDE\arduino-1.8.7\hardware\tools\avr/bin/avrdude -CC:\ArduinoIDE\arduino-1.8.7\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM2 -b115200 -D -Uflash:r:hexfile.hex:i

The "w" is changed to "r" to do a read from flash instead of a write from flash.
The "hexfile.hex" is the output filename. You can use any filename you like.

The easiest way to generate the base command is to:

  • Turn on verbose output in the Arduino IDE (File > Preferences > Show verbose output during: > upload).
  • Do an upload. It doesn't matter if the upload is successful or not. Make sure not to upload to your Uno, otherwise you'll lose the program that you want to save!
  • Scroll up the black console window at the bottom of the Arduino IDE window until you find the avrdude command generated by the Arduino IDE. Select and copy that command to the clipboard.
  • Paste the avrdude command to a text editor or the command line and make the required modifications.

AVRDUDE option documentation:
AVRDUDE: 2.2 Programmers accepting extended parameters

I have problem to run this ….
I try whith USBASP V2.0 programmer …..
That run without error, but noting is record, I haven't files in PC….

Please post the command you're running.

-c avrispv2 -p m328p -P usb -b 115200 -U flash:r:"C:__________GRBL_CNC\essais.hex":i -U eeprom:r:"C:__________GRBL_CNC\essais.eep":i