This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Code Extraction - Please Help

Other Parts Discussed in Thread: MSP430F5438

Hello all,

 I am writing this as a sort of last ditch effort to save my code.  I have two very lengthy programs written for the MSP430F5438.   I have been using the IAR Embedded Workbench IDE to program my microcontrollers.  The code itself is fine and works on the controllers I have downloaded to, but recently and to my dismay the code on my computer and my backup was destroyed.  What I am wondering is if there is any way I can extract my code from the microcontrollers I have programmed already. I understand this is probably not possible because most programmers will not want others to be able to extract their code from the controllers, but I figured it wouldn't hurt to ask.  Please if anyone has an answer on this, I'd really appreciate a response.

  • Yes, it is possible to extract what is already inside the F5438, provided that: (a) you did not try to protect the code nor has the code distruicted something or self-distructed and (b) you do it very carefully.

    Note that the Flash only has machine code and constants. It is relatively easy to reconstruct them into assembly code. But if your original code is in c, you may find it very difficult to do.

  • Ah yea, my original code is in C.  Don't know if it's worth the effort to extract it since I need it back in C format.

  • old_cow_yellow said:
    , it is possible to extract

    I am also curious to know how we can extract the code out of a MCU like MSP430FXX?!

  • The "code" that is already inside MSP430Fxx is "machine code". As long as the "JTAG Fuse" is not "blown", you can use "JTAG" tools to extract the contents of the Flash and hence all the machine code, constants used by the machine code, and other junk. You can do the same with BSL too if you know the password.

    If you are thinking of source code, that is totally different. Your MSP430Fxx probably has never seen it, cannot do anything with it. You do not expect to extract your e-mails from your MSP430Fxx. Do you?

  • You better off putting a effort in to deep scan un-delete on your hard drive for the lost source code
    than trying to reverse  the machine code that is inside the mcu in to Assembler 
    and it's nearly impossible to get it back to C.

    msp430 runs compiled code and does NOT  have the source code in flash for at run-time compile like C# could. 

  • old_cow_yellow said:

    The "code" that is already inside MSP430Fxx is "machine code". As long as the "JTAG Fuse" is not "blown", you can use "JTAG" tools to extract the contents of the Flash and hence all the machine code, constants used by the machine code, and other junk. You can do the same with BSL too if you know the password.

    If you are thinking of source code, that is totally different. Your MSP430Fxx probably has never seen it, cannot do anything with it. You do not expect to extract your e-mails from your MSP430Fxx. Do you?

    No! Of course not Email address. Let me explain in other way. Let's say I have a device which includes a MSP430Fxx and does a specific job. The code is not mine and I am curious about the code which is running in MCU. You mentioned FET. But FET is not only to load the code? I know there is bunch of 0 and 1 running in MCU but can I get those? If get those I think that I am able to decoded to assembly or other languages. Right?

    And Flash you mean RAM? Or MCU's flash which may not be used by the program itself. 

  • Most debuggers have the option to "Debug without Loading" or something to that effect. Many other "Programmers" also have the options to "Read the current Flash memory". Even BSL have the option to read the current contents. (But without the correct password, BSL may erase all the Flash !)

    My joke about extract e-mail is a parallel to extract source code.

  • > Let's say I have a device which includes a MSP430Fxx and does a specific job.

    Cloning a msp430 to another msp430 is easy, just read the whole flash (and maybe info too) and write it back to
    a new msp430. But if the code is for sale it would be unethical and illegal to not pay for it.

    If the Fuse have been blown only BSL let you get back in and if you guess wrong password
    you may clear all flash and brick it.

    And it would be very hard to understand and make changes to the code, as there are no Assembler labels etc,


     

**Attention** This is a public forum