Maker Pro
Maker Pro

Downloading programs from Microcontrollers

philw1985

Aug 18, 2023
1
Joined
Aug 18, 2023
Messages
1
Hi,

I'm fairly new to microcontrollers, i did a module on them at university a long time ago. My experience is mainly with Programmable Logic Controllers. I was wondering if I had a microcontroller on a circuit board, like a 8085, but no other information about how it works, is there a way to read the program from that controller?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,728
Joined
Nov 17, 2011
Messages
13,728
The 8085 has the program code in an external ROM/EPROM/FLASH. Comparatively easy to read with a suitable off-the-shelf EPROM reader device, possibly built from a modern microcontroller. That works with (almost?) every microcontroller that uses external program memory,

Modern microcontrollers with internal program memory (usually FLASH) usually also can be read by using the programming interface (it will depend on the microcontroller what interface is used). But modern microcontrollers also often include so called fuses to prevent exactly this kind of tampering. One may be able to program the controller, but reading the internal program memory is prohibited.

Assuming you can read the memory, you'll be faced with a bunch of data, typically in hex code or even binary format. You will then have to dissassemble the data into assembler code. That's in most cases the best you can do. No "C", "C++" code or such. Your next step is to decipher and understand the assembler code. It will contain lots of automatically generated symbols (for addresses, variables etc.) but lacking the information from the compiler and linker, these symbols will be nothing but a soup of alphanumerical "words", not the names of variables or subroutines used when the code was written.
 

kellys_eye

Jun 25, 2010
6,514
Joined
Jun 25, 2010
Messages
6,514
is there a way to read the program from that controller?
As above however if you look at the size of the memory devices you might see they will contain anywhere between 2048 bytes of code and 4 MEGA bytes of code. Getting the code out is one thing - the time taken to decipher it could be astronomical!
 

danadak

Feb 19, 2021
768
Joined
Feb 19, 2021
Messages
768
The best analogy to the task you have is consider counting the number of grains of sand on
a beach. Can be done, thru a huge resource like get 100,000 low cost workers, give each one a
cup of sand, and ask them to count.

In your case doubly worse, because one has to understand the external hardware, its design interaction
with user. The original coder, if any good, extensively commented his code and its specific functionality.
But your code base strips away all that descriptive information, and you are left with grains of sand.

Note Chinese have been known to tackle parts with fuses that prevent reading internal code. They use
a scanning electron microscope and read each memory flash bit to determine its state.


Good luck.


Regards, Dana.
 
Top