I have a used board and need to save the program that is on the board before I reprogram it. Is there a way to do this?
You can normally get the binary - but the source code will take reverse-engineering to extract,
don't know if there are any good tools for that.
What are you trying to do?
i want to use the board for something else but would like to save the program thats on the it before I wipe it out.
Typically you have the code, and it should be a simple matter of rebuilding and reinstalling it under the IDE.
Though, it may depend on whether you have the copy of the specific code that was downloaded, and that you haven't changed the code since then.
Since I am a programmer, I find it second nature to put all of my Arduino files in a source code control setup, so that at any time, I can go back to previous versions. You might get into a habit of storing previous versions of the sketches when you get to a stopping point, in case you ever want to recreate how things were.
However, if you still need to do it, the avrdude program can read from the microprocessor memory, as well as writing to it. In particular, the -U option with a 'r' op field, will read from the microprocessor memory and write the contents to a file.-U memtype:op:filename[:format]
Perform a memory operation as indicated. The memtype field specifies
the memory type to operate on. The available memory types are device-
dependent, the actual configuration can be viewed with the part command
in terminal mode. Typically, a device's memory configuration at least
contains the memory types flash and eeprom. All memory types currently
known are:
calibration One or more bytes of RC oscillator calibration data.
eeprom The EEPROM of the device.
efuse The extended fuse byte.
flash The flash ROM of the device.
fuse The fuse byte in devices that have only a single fuse
byte.
hfuse The high fuse byte.
lfuse The low fuse byte.
lock The lock byte.
signature The three device signature bytes (device ID).
fuseN The fuse bytes of ATxmega devices, N is an integer number
for each fuse supported by the device.
application The application flash area of ATxmega devices.
apptable The application table flash area of ATxmega devices.
boot The boot flash area of ATxmega devices.
prodsig The production signature (calibration) area of ATxmega
devices.
usersig The user signature area of ATxmega devices.
The op field specifies what operation to perform:
r read device memory and write to the specified file
w read data from the specified file and write to the device
memory
v read data from both the device and the specified file and
perform a verify
The filename field indicates the name of the file to read or write.
The format field is optional and contains the format of the file to
read or write. Format can be one of:
i Intel Hex
s Motorola S-record
r raw binary; little-endian byte order, in the case of the flash ROM
data
m immediate; actual byte values specified on the command line,
separated by commas or spaces. This is good for programming fuse
bytes without having to create a single-byte file or enter
terminal mode.
a auto detect; valid for input only, and only if the input is not
provided at stdin.
d decimal; this and the following formats are only valid on output.
They generate one line of output for the respective memory
section, forming a comma-separated list of the values. This can
be particularly useful for subsequent processing, like for fuse
bit settings.
h hexadecimal; each value will get the string 0x prepended.
o octal; each value will get a 0 prepended unless it is less than 8
in which case it gets no prefix.
b binary; each value will get the string 0b prepended.
The default is to use auto detection for input files, and raw binary
format for output files. Note that if filename contains a colon, the
format field is no longer optional since the filename part following
the colon would otherwise be misinterpreted as format.
As an abbreviation, the form -U filename is equivalent to specifying -U
flash:w:filename:a. This will only work if filename does not have a
colon in it.
That helped a lot. Thanks