HELP, trying to download program from arduino board

I currently have lost my program that i need, but have working boards, have seen previous posts about downloading the source code from the board then up loading to another (source code only i think)

Is anyone able to help?

thanks

You can't download source from a board, because there isn't any source there.

what code can be downloaded then?

Re: how to download the current code from an arduino board?

1

Dec 22, 2011, 06:20 am Yes, look up avrdude. You'll want to use something like this (it worked on my computer, but you'll have to change the ports and probably some other stuff.)

You open up cmd (assuming windows; essentially same for linux and mac though), then type Code: [Select]

"C:\arduino-1.0\hardware\tools\avrdude -p m328p -C C:\arduino-1.0\hardware\tools\avrdude.conf -c arduino -D -P COM5 -U flash:r:output.bin:r"

changing each of the "C:\arduino-1.0"s to where your arduino is located (it should work on multiple versions) and changing "output.bin" to where you want the output going.

The small problem is that it's not in C++ anymore, it's in machine code. Meaning you can't* edit it

*conditional can't

There is no way to get the C++ out of it, save disassemblers and stuff. Report to moderator Quote Nick Gammon avatar_nickgammon


Global Moderator Brattain Member Posts: 21,459 [add Karma] Logged Lua rocks! Gammon Software Solutions [add Karma]

Re: how to download the current code from an arduino board?

2

Dec 23, 2011, 08:19 am Agreed. To get the "binary data" off the chip do something along these lines:

Code: [Select] avrdude -c usbtiny -p m328p -U flash:r:myfile.hex:i

Then attach the other board and do:

Code: [Select] avrdude -c usbtiny -p m328p -U flash:w:myfile.hex

The "r" version reads the flash memory, the "w" writes it.

You will need something like USBtinyISP to connect to do this.

http://www.ladyada.net/make/usbtinyisp/

As WizenedEE said this will not give you back the sketch (in C++) but you can make another board behave the same as the first one.

this was what i found from a post years ago

this will not give you back the sketch (in C++) but you can make another board behave the same as the first one.

Out of curiosity, could a (very) skilled programmer deconstruct the compiled file into a usable one? Usable as in they could read it at the least and rewrite a new sketch that pretty much copies the first?

im just wanting to know if its possible to make a another board do the same as the first by copying what ever info is available from it

Read AWOL’s post above, in regards to the post you made.

yea, so does anyone know how to make it happen? what code etc do i need to download the info to make another one do the same thing?

http://www.ladyada.net/learn/avr/avrdude.html

I have a copy of the source code, but I'm not 100% sure it is truly the same as the version last uploaded to the board.

Before trying to upload the code I have, I want to make a backup of the binary actually deployed on the board. (so if the new code doesn't work, I can always go back the orginal binary).

This post is kind of old, I was wondering if this method to download the binary from the board is still valid? If not, anyone know how I can do this?

Or just get another board ...

Yes that method is still valid, for the AVR based Arduinos.