The following was asked back in 2010, with no answer, so I am asking it again.
Is there a way to read out the code on an UNO? Although there is by definition no proprietary code on the chip used, there is no information available of the algorithm used when loading in a program written by the user. I am familiar with the code used by Intel and Motorola when programming for one of their older chips like the 8080 or 6809, but am not aware seeing the code form used for the AT chips used in the Arduino. Any comments, anyone?
If the protection fuses are not set, you can get the hex file out, but it will only contain assembly code.
You can use avrdude to read out the flash and eeprom memory, that comes up a lot.
Then you'd need a C++ Disassembler to get the hex code you read out and return it to assembler and some semblance of bare C++ commands.
The hex file creation process is plenty documented. You can select File:Preferences, turn on Verbose Outputs, and Verify a simple sketch and watch the process and commands happen even.
A simple bootloader is included in the '328P datasheet, and the commands for loading a bootloader from the SPI interface using a Programmer are documented also.
KeithRB:
If the protection fuses are not set, you can get the hex file out, but it will only contain assembly code.
The chip does not store or use a hex file.
hex files are used by tools like avrdude and bootloaders.
You can get the binary data from the chip and generate a hex file from that using a tool like avrdude.
--- bill
there is by definition no proprietary code on the chip used
How do you figure that?
there is no information available of the algorithm used when loading in a program written by the user.
If there is no source code or documentation available, perhaps the algorithm IS proprietary. Not providing source is a first step in keeping something proprietary, even if you are somewhat weak in protecting the binaries.
I am familiar with the code used by Intel and Motorola when programming for one of their older chips like the 8080 or 6809, but am not aware seeing the code form used for the AT chips used in the Arduino.
It's relatively easy to retrieve the binary contents of the flash memory. It's slightly more difficult to decode that into AVR assembly language (which is what I assume by "code form" - if you haven't seen it, you haven't looked for it. It's all well documented in Atmel data sheets and etc.) After that it becomes MUCH more difficult to recreate a C or C++ equivalent form that clarifies things at the algorithmic level...
asked back in 2010, with no answer
I've seen it asked several times, and it always gets about this answer... Sometimes it's shortened to just "no, you can't get the original code from the chip", which is probably appropriate for most Arduino users.
hbl2015:
<...>
Is there a way to read out the code on an UNO?
The whole process is detailed here for Windows users.
Ray