Go Down

Topic: Download code from a Arduino Board to Arduino Soft (Read 4527 times) previous topic - next topic


Hi every one.
It might be a stupid quetsion but you know what people say. There is no stupid questions.

Anyway I can't remember which of my boards have which code on it.
I don't want to look at all my programs and guess which one is the right one and then overwrite the precious code on the board.
So is it possible to download ( decompile? ) the code from the board to the arduino software. Maybe there is a anti-Arduino that transform machine code to Human code.

Thanksssssssssssssssssssssssssssssssss :)


Oct 19, 2008, 06:24 pm Last Edit: Oct 19, 2008, 06:29 pm by gnu_linux Reason: 1
You can do something like this using avrdude

avrdude -D -p m168 -c stk500 -P $port -U flash:r:$filename: -v -v -b 19200

to read the flash on your ATmega168 and write it to a file on your computer

You'll have to adjust the settings for your system

I'm not sure if there's a decompiler but you can save your .hex files and corresponding binaries and keep track of their checksums to figure out which program is loaded on a chip.



avrdude -F -v -v -v -v -pm168 -cstk500v1 -P/dev/ttyUSB0 -b19200 -D -Uflash:r:program.bin:r

will write the data from the ATmega168 to program.bin on a Linux system using /dev/ttyUSB0 as the USB port at 19200bps

This was tested and seems to work



I looked for a "how to install avrdude" on mac and that looks complicate. I've put the avrDude folder in my home directory and tried your command line but that didn't work. I added sudo but it gave me a warning, so I am not really sure if I should do this.

I am going to try it on linux tomorrow as it might be simpler and I don't mind messing around the linux computer as I have nothing on it.

Thank you for helping me.


Oct 19, 2008, 07:36 pm Last Edit: Oct 19, 2008, 07:37 pm by gnu_linux Reason: 1
I am not sure about the Mac but you can easily install avrdude on most Linux systems.

On yum systems => yum install avrdude

On apt-get systems => apt-get install avrdude

This usually takes just a couple of minutes.

Ubuntu and Fedora both have avrdude and avr-gcc packages and since they offer live CDs you can install it on just about any computer with internet access without having to install the OS.



Great!, I've got Ubuntu 8.4 installed so that you should pretty straight forward then.


Oct 19, 2008, 07:53 pm Last Edit: Oct 19, 2008, 07:57 pm by gnu_linux Reason: 1
Code: [Select]

sudo su -

apt-get install avrdude

avrdude -F -v -v -v -v -pm168 -cstk500v1 -P/dev/ttyUSB0 -b19200 -D -Uflash:r:program.bin:r

should do the trick then :)

Ubuntu has the following packages =>

avr-libc (1:1.4.7-1) [universe]
   Standard C library for Atmel AVR development
avra (1.2.2-1) [universe]
   Assembler for Atmel AVR microcontrollers
avrdude (5.5-1) [universe]
   software for programming Atmel AVR microcontrollers
avrdude-doc (5.5-1) [universe]
   documentation for avrdude
avrp (1.0beta3-6) [universe]
   Programmer for Atmel AVR microcontrollers
avrprog (0.2.1-14) [universe]
   Programmer for Atmel AVR microcontrollers

The full list is here http://packages.ubuntu.com/hardy/allpackages


I looked for a "how to install avrdude" on mac and that looks complicate.

avrdude is part of the OS X Arduino install.


Go Up