This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CAN I COMPILE OBJ FILE

HI
iam new to microcontrollers, iam working on c8051f003,my question is can i compile obj file or can i extract assembly code from obj
and save as .asm will it work


regards
wilson

  • You cannot compile an OBJ file. An OBJ file is the result of something that has already been compiled or assembled.

    It is theoretically possible to link an OBJ file to a target code image file, such as OMF, HEX or BIN format. Then using a disassembler it is feasible to derive an asembly language listing of the corresponding code. However it is a rare case where this is a productive exercise. In 99.6% of cases it is better to search out the original source code or to re-write the code over again from scratch.

    Michael Karas

  • The tool you're looking for is usually called a "disassembler". Translation back to C would often be called a "decompiler".

    http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=8051+disassembler

  • "Translation back to C would often be called a 'decompiler'."

    Most often, it's just called highly improbable ;-)

    With assembler, each source instruction creates exactly one machine instruction - so, conversely, each machine instruction can be converted back to the source instruction that created it.

    With high-level languages (such as 'C') this is not so; a single source instruction is likely to create very many machine instructions. Also, many different source lines could be implemented with the same sequence of machine instrucions.
    THus it is extremely difficult to "decompile" from machine code to 'C' source.

  • Wilson,

    what you're asking here is essentially impossible. The usual reply is that decompiling is about as easy as turning BigMacs back into cows.

    OTOH, it's highly likely that you're just asking the wrong question. So go back a couple of steps and ask yourself: why do you think this is what you have to do? If you post your answer here, odds are high someone will be able to show you where in that reasoning you went wrong.