Pages: [1]   Go Down
Author Topic: Download code from a Arduino Board to Arduino Soft  (Read 1975 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 430
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

smiley
« Last Edit: October 19, 2008, 11:29:01 am by gnu_linux » Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 430
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

smiley
Logged

UK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 430
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

smiley
« Last Edit: October 19, 2008, 12:37:12 pm by gnu_linux » Logged

UK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 430
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:

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 smiley


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
« Last Edit: October 19, 2008, 12:57:10 pm by gnu_linux » Logged

New Zealand
Offline Offline
God Member
*****
Karma: 0
Posts: 999
Arduino pebbles
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: