Search code examples
assemblyembeddedromhex-file

why is there a object to hex converter in the end?


I am studying assembly language programming.I came across steps to a program for a microcontroller. In the last step why is the .obj file is converted to .hex file. The process says that file is converted to .hex and burned to ROM.As per my understanding the .obj file is already a machine language code and can be run. If this question makes sense please explain why is there a need of OH converter in the last step?enter image description here


Solution

  • "obj" could be anything, there's no standard. It may be machine code, it may be some abstract "object code" format, it may or may not contain debugging information (such as variable/function names). Typically it is not the final binary but a format that the linker understands.

    Even if you write in assembler, you have to download that code into memory somehow, either through an in-circuit debugger or through a dedicated circuit programmer. Then you need a file format that your tool can handle.

    "abs" is typically machine code but with debugging information included, used for downloading and troubleshooting a program through a debugger.

    "hex" is standardized "Intel hex" format, which is raw machine code with no debugging info, expressed in an ASCII format. It is commonly used by in-circuit programmers and a common format to use for the final product binary in production. (Other such common formats are .bin and .s19)