How to create a executable hex from elf file format

DevC picture DevC · Oct 18, 2013 · Viewed 20k times · Source

I am very very new to this, I have elf file input.out and need to create hex executable from it. I am using objcopy to create executable in intel hex format as follows

objcopy -O ihex input.out out.hex

by this out.hex contains data from all sections (.interp, .note.ABI-tag etc), but i am not sure if all of it is required for executable. Is just .text section enough for creating executable hex so can i just use as below or any more sections are required

objcopy -j.text -O ihex input.out out.hex

Also if there any good reference to understand this in detail, I couldn't find much by Goggling. Probably I don't know what to search.

Answer

Bolor picture Bolor · Jan 24, 2017

It could work with

objcopy -O ihex input.elf output.hex