2

I'm using a Keil C51 tool to compile my firmware which outputs a .obj file (I'm writing firmware for an 8051). However, I'm looking towards using another tool to debug the firmware which only takes in elf or dwarf files as an input. So I was wondering if there are any tools out there that can convert my .obj file to elf or dwarf file?

I did some digging on the Keil website (here) and according to it, the obj file that is generated is OMF-51 (not sure why 51 is mentioned in the format name).

With this information I tried using a tool that I found on Github called objconv (here) which claimed to be able to convert OMF to ELF but I ran into an error when I tried it.

I hope someone can suggest some simpler ways to solve my problem or any other tool that is out there.

Edit : I tried using objcopy and looks like OMF-51 is not a supported format. Please correct me if I'm wrong.

user3547407
  • 187
  • 1
  • 12
  • What did your research for another compiler (generating ELF output) reveal? -- What errors did the converter output? -- Which other tool would you like to use for debugging? Did you try to use `objcopy` (from the "binutils" of GCC) to generate ELF object files? -- OMF-51 is a special flavor of OMF for 8051. – the busybee Jan 15 '20 at 06:58
  • 1
    * Changing my compiler is my last resort and I haven't looked much into this. I will consider this when nothing else works. * I ran the following command : objconv -felf32 -nu main.obj genelf.o and I get the following error : Error 2018: Unknown type 0xFF026F70 for file: main.obj (I uncommented a line in the source code to get the error code) * Thanks for referring to this tool. I will look into it now. – user3547407 Jan 15 '20 at 16:27
  • FYI *objconv* and *objcopy* are two different tools. *objcopy* is part of GNU binutils, and it doesn't support OMF. – pts May 20 '23 at 21:29
  • It's unlikely that the ELF or DWARF formats will be useful for developing for the 8051, because the 8051 is an 8-bit microcontroller, and ELF supports 32-bit and 64-bit. It's possible, but very unlikely. Do you have an example ELF file which your *another tool* supports? Can you link (attach) it to the question? – pts May 20 '23 at 21:34

0 Answers0