I have an Uno R3 which has a working, compiled program which run an LED array based on sensor input.
Long term, I will need to re-code the program, since the source is lost, but I need that same code on multiple, identical Uno R3 devices, in the next couple of days.
Is there a way to copy it to a second (or multiple) identical Arduinos?
I know that it is not possible to decompile, I'm looking for a short term fix, because I have a deadline which will come before I can learn enough to re-code the program.
CrossRoads:
Sure, once you get it to where it will compile, you can upload it to as many Unos as you want.
Well each upload initiates a new required compilation from the source sketch which the OP said will or is not available, so your suggestion is not something he can use. What is required is a command line script to use AVRDUDE directly to read back the binary contents of the flash memory on the prior uploaded chip and then a write to each new chip again using AVRDUDE directly. At least that is my take on the OP's question. But then again we both may not have a clear picture of what he is asking and in need of?
Re-coding was mentioned, hence fresh compile would be available.
I don't know if the original can be downloaded from the existing chip (possible via avrdude if fuses allow that), if so the avrdud commands can be used to load same into additional chips. Not my cup tea tho, need someone with avrdude experience.
I suspect its easier to do (for me anyway) with Atmel's AVR Studio and an AVR ISP MKii programmer.
That last is correct. i apologize if I wasn't clear. I do not have source to compile from. I need to read back the compiled code, and write it to the additional Arduinos.
I'm pretty much completely new to all this, so instructions which are detailed and step by step would very much be appreciated. Thanks for taking the time to answer me.
I will re-code at some point, but this is a job that got dropped on me, and the deadline is too close to be sure that I can learn what I need in time. Copying the compiled code will hopefully let us function, while I learn what I need to know to rewrite the code.
A brief explanation
-c arduino programmer is arduino
-P com20 The com port that arduino connects to
-p atmega328p Partnumber, The mcu on an Arduino is Atmega328p
-Uflash memorytype is Flash as opposed to EEPROM
r read
d:\hexfiles\test.hex:i the path and filename on your computer (the i indicate Intel hex)
So what you could do is:
Connect the Arduino with the sketch you want to copy to your PC via USB as normal, and observe the com port
Make a command window and type the avrdude command to copy the Flash
Connect The Arduino you wish to copy to, via the USB
Make a command window and type the avrdude command to write the file to Flash
When I tried to use avrdude to read a chip, I found that more was needed that posted previously. For example, this is what I had to use when I wanted to read back from a tiny84 using ArduinoISP:
I found that more was needed that posted previously
That depends on the settings of your Environment Variable.
It is described in the WinAVR user Manual.
For example I can use avrdude from anywhere without specifying the path, as you do.
First off, Yes I know I'm replying to an old question, my answer is more for anyone who stumbles upon it (Like me)
The other day I copied a working Arduino's contents (i.e., sketch etc) to another, I used the Atmel AVR studio with one of their in circuit programmers (using the 6 pin header). So if you have, or know someone with an Atmel programmer, give it a go.
I bought a batch of Arduinio Nano Chineese clones, one has either a faulty USB chip, or the micro has a faulty serial port, eitherway, it cannot be programmed via the regular Arduino environment.
So to make use of an otherwise dud board, I can upload a finished/debugged etc sketch to a good Nano, then copy it over to the dud board via AVR studio, freeing up the good board for the next project.
This is also, a possible solution if you want to distribute a working Arduino program without sending them the source code, or even letting them know you did your programming in Arduino.
pastubbs:
This is also, a possible solution if you want to distribute a working Arduino program without sending them the source code, or even letting them know you did your programming in Arduino.
So instead of simply providing them with a copy of avrdude.exe, avrdude.conf and libusb0.dll, or using XLoader or similar, they have to install the full Atmel Studio? Sounds like doing it the hard way to me.
I can upload a finished/debugged etc sketch to a good Nano, then copy it over to the dud board via AVR studio
But if you're going to upload it to the dud board using ISP afterwards anyway, why upload to a good board, then copy it back to upload to the dud board. Why not simply use ">Sketch >Export compiled binary" to generate a hex file directly from the IDE, then upload that to the dud board with your ISP programmer?
Led array and sensor input. Doesn't sound that difficult to write new code with same behavior. I mean, you're either going to spend your time learning to extract machine code, then spend more time writing a new sketch as you've said you'll have to do anyway.
It'd be silly to exchange one learning curve for another possibly more complex one because you don't understand the scope of either.