Reading source code from microprocessors

Discussion in 'Embedded Systems and Microcontrollers' started by JuanjoGele, Aug 10, 2016.

  1. JuanjoGele

    Thread Starter New Member

    Jul 15, 2016
    7
    0
    Hi guys!

    I wonder if there is a way to read the source code from a microprocessor. I have in my own a few microprocessors and I want to read them. They are from different developers. I have microprocessors from NXP, Xilinx, Nuvoton and Atmel.

    I just want to know if a socket to read any of them exists. I want to change its source code to improve it. I would like to have the libraries they use. I have been investigating in some pages and I saw a device called Cyclone Universal but I don't know if it is very useful.

    Best regards. Thank you.
     
  2. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,131
    267
    1) Some micros have code protection and cannot be read

    2) The code you extract is not source code, it's raw assembly code, not human readable.

    While what you suggest is theoretically possible, it would be the intellectual equivalent of climbing Everest with no oxygen and 2 broken legs.
    You would have to breakdown the function of the software by brute analysis of the gibberish opcodes.

    There are programs called dis-assemblers, but this only gets you 1% started
     
    absf likes this.
  3. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    Most microprocessors have their programs stored externally in ROM, otp-PROM, EPROM or flash memories. Unlike microcontrollers who store their programs inside the uC chips.

    You can extract the object codes from the external ROM if you have the device readers. But as @Sensacell has said the code is hard to interpret if you do not understand how the uP is connected and where the IOs are going...
     
    atferrari likes this.
  4. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,648
    764
    Chances would increase if you have a functional board available. There is one guy posting in EEVBlog who does reverse engineering with sophisticated techniques and elements but always on a complete circuit.
    Not precisely what you would try to do.

    But then, if you got the capability to improve a certain piece of code, you could be in condition of writing the equivalent from scratch. That is what I would try.
     
    Last edited: Aug 10, 2016
    absf likes this.
  5. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    Depends on the human :)
     
    joeyd999, #12, absf and 1 other person like this.
  6. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    I am sure those pioneers (like Steve Wozniak or Bill Gates) who develop computers like Apple II and Atari should be able to read the HEX of 6502 and convert them to assembly without the help of a computer.

    I can only remember a few like A9 = LDA #$xx and 60 = RTS. And what is 8D ? STA $xxxx perhaps...

    Allen
     
    Last edited: Aug 10, 2016
  7. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,648
    764
    Reading easily, maybe you could but reconstructing the logic behind the code, that is the hardest part.
     
  8. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    There are such things as "de-compilers", software that can take an assembly language file, or maybe hex code for a particular processor, and generate a high-level language file from it. I'm highly dubious about whether that file would have any resemblance to code that a human would write or could ever understand, but maybe it can work.

    Here's someone who says they can do it:
    https://www.hex-rays.com/products/decompiler/
     
  9. hp1729

    Well-Known Member

    Nov 23, 2015
    1,954
    219
    Sure you can. Manually or by a dis-assembler/ Done it often.
    What kind of programmer does he have? Put it on the programmer and read it, if it can be read.
    No programmer? It depends on the chip.
    Vague questions can only get vague answers. What specific type of chip does he have?
     
    absf likes this.
  10. Nathan Hale

    Active Member

    Oct 28, 2011
    125
    2
    Can you elaborate on this code protection? How do they go about doing it?
     
  11. SLK001

    Well-Known Member

    Nov 29, 2011
    819
    228
    There is a fusible link that can be fused to make the code unaccessible.
     
  12. hp1729

    Well-Known Member

    Nov 23, 2015
    1,954
    219
    As simple as setting a latch that disables reading memory. It can only be cleared by clearing program memory.
     
  13. JuanjoGele

    Thread Starter New Member

    Jul 15, 2016
    7
    0
    Thank you all for your responses!
    Im gonna be more accurate. I need to read different microprocessor structures. I attach a few photos of the microprocessors i wanna read.
    I just need an universal socket to read them. I just want to read it, then i will think about how interpret its content.

    Thank you so much guys!
     
  14. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,694
    904
  15. hp1729

    Well-Known Member

    Nov 23, 2015
    1,954
    219
    I think we need more info on microprocessor types. House numbers don't help. Find out what family each is and get a data sheet to tell how to read them, if it is possible. Some of them may just be programmable logic and not an actual processor at all.
     
  16. JuanjoGele

    Thread Starter New Member

    Jul 15, 2016
    7
    0
Loading...