Go Down

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

TM

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 :)

gnu_linux

#1
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.

:)

gnu_linux

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

:)

TM

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.

gnu_linux

#4
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.

:)

TM

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

gnu_linux

#6
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

follower

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

avrdude is part of the OS X Arduino install.

--Phil.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy