Can someone find a way to reload a proram already in a microcontroller please. Its a standard in other computers as we could edit a program already in the system
is it a conversion of machine code to back to english
Thnak you
Can someone find a way to reload a proram already in a microcontroller please. Its a standard in other computers as we could edit a program already in the system
is it a conversion of machine code to back to english
Thnak you
I moved your topic to an appropriate forum category @neilal.
In the future, when creating a topic please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.
Thanks in advance for your cooperation.
thanks - but this is a difficult topic to pick dear. it doesnt fall into any of the categories mentioned. anyway thanks - so in which category is it now? pl reply as i need this info
Answer is the line of text below the thread title, near the top of page. It's in the Development Tools section, category Uploading.
As for your answer, your Arduino program is translated to assembly code before uploading; you can read the code back(but not in the IDE), but it becomes a binary file, not the original "C++" sketch. Much further work would be required to have any sense of what the code was doing.
If you don't have any record of the last program uploaded to the Arduino, I suspect you are out of luck.
Depending on which microcontroller, and whether it allows protecting loaded code, and whether said code was protected, the answer could be yes, no, or maybe.
Want a better answer? Provide details.
I have been involved with computers since 1959. I don't recall it being 'standard'. In fact, it is highly unlikely you can edit the executable. If it were written in assembly, maybe, but any high-level language requires a decompiler, and in my experience, that's a lot of work. The best, simpler answer is to use the source code. It was harder when we had punched cards, but it's a piece of cake now.
So you wrote a program on a PC, compiled it and lost the source code. How would you edit?
Well, for lot of 8bit computers there was build in BASIC and if you upload one of your BASIC programs, you could edit it in system.
It is not microcontroler, but it fall under
(and all kind of scripting laguages somehow fits to this description too - like *.BAT in DOS/Windows or *.sh in Linux, or *.py anywhere ... ) (that is if you read it like "other computers" == " other computers than microcontrollers mentioned in previous sequence")
In case others have not made it clear enough for you... No, it can't be done. The C++ code you started with is not uploaded to the board, only the machine code version. That cannot be translated back to C++ in any way that would usefully resemble your original code, it's pretty much a one-way process.
The only way that could be achieved would be to upload the original C++ source code as well as the machine code version. But that would not fit into the flash memory of many Arduino, unless it was a very tiny and trivial code.
You may be thinking of Python code or other interpreted or scripting languages. This is possible with more powerful computers with lots of memory. They need to have that because additional memory and processing power is required for the language interpreter code, on top of your own code.
Interpreted languages are typically 20 to 50 times slower to run than equivalent compiled code, which would make it too slow to be useful on many Arduino models.
English is not a coding language, at least not yet!
You do not seem to understand a compiled language versus an interpreted. Also a BAT, sh, py is NOT in the same domain as c or cpp or for, pl1, plI, cob, pas etc etc.
Hi @neilal. As others already explained, it is the "edit a program" part of your goal that is the challenge. This would require the following sequence of operations:
The challenge is in step 3. You could in theory skip the reverse engineering and edit the assembly code directly. However, you will likely find this code to be incredibly cryptic for anything but the most simple program (and if the program was simple then you could just rewrite it in less time).
Now if you didn't actually need to edit the program, the endeavor would be far more feasible. In this case, steps 2 - 5 can be skipped:
This might be useful in the case where the program already on the Arduino board is fine as is, and you only want to deploy that program unmodified to other Arduino boards. You might do that in the case where you wanted to create additional copies of the device, or perhaps to make a replacement device if the original board was damaged in some way that left the microcontroller still in a functional state.
I've probably missed something here? Is your MCU programmable by the Arduino IDE? If so, presumably its sketch did not include code that prints its path and sketch name, allowing possible identification of the original?
@Terrypin raises an excellent point that it is possible the source code is still present on your computer.
Even if you have deleted the original sketch files, Arduino IDE copies your sketch to a temporary folder during the compilation process. It is possible the full sketch is still stored in that folder.
We can tell you the location of that folder if you will provide us with the following information:
This storage location is temporary in nature. It might be overwritten by Arduino IDE or deleted by your operating system at any time. So if you are going to try to recover the sketch from this location, you should do it as soon as possible and immediately move it to a safe location once you find it.
You should also be careful to avoid performing actions that could possibly trigger the loss of the data before attempting the recovery:
If you find the sketch file in the temporary folder, you will notice Arduino IDE made some changes in the code. These changes are minimal so it will be easy to convert the code back to your original sketch. We can help you out with that if you have trouble.
I wrote few compilers and couple of interpreters myself, so I probabelly know at least something.
As you noticed, I said "scripting laguages", which are usually interpreted and so the programs for them are usually stored on target computer in readable form - which can be edited in the system. (usually ... Every good rule have even better exception.)
And that is kind of "standard in (some) other computers" and was even more usual on older 8bits computers like ZX Spectrum, BBC Micro etc, etc ...
On modern PCs may be large systems in Python (I myself wrote one with more then 1M lines), which also fits this description. And on microcontrollers run microPython, which probabelly also fits this description.
About domains ... all those can be used for making programs, which do something on computers, andwhich somebody may want to edit. Some are better for some kinds of problems, but neilal did not specify which computers does consider as standard for this question.
The system is a PC connected to board. The PC is where the text code is kept and compiled. The board gets machine instructions written to flash with bytes from the PC. The system is both parts.
How did your board get the instructions it has now?