Keil Logo Arm Logo

.hex to .elf conversion?

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Mudassir Rasool
12-Jun-2008 19:43 GMT
New! .hex to .elf conversion?


I am using SDCC compiler to run my C code on CC2430 (which contains 8051 controller). Problem is that SDCC generates .hex file! But I need a .elf file as output, because I want to use an elf_Loader to dynamically relocate the code! I have read a lot about SDCC compiler and there is no way that I can generate .elf from it!

So is there any way to convert .hex to .elf???
If not, then how can I interpret and read the .hex file after it has been loaded on the target board?

Thanks in advance,

Andy Neil
12-Jun-2008 20:05 GMT
New! Do you realise where you are?

"I am using SDCC compiler..."

Don't you think it's a bit cheeky to be using Keil's forum, then?!

" run my C code"

No, a compiler does not run code - it merely translates it from source to object.

"dynamically relocate the code!"

Doesn't sound like a great idea for 8051 code - why do you want to do it?

"So is there any way to convert .hex to .elf???"

You'd probably have to convert the hex to binary, and then from binary to elf...

Per Westermark
12-Jun-2008 20:42 GMT
New! RE: Do you realise where you are?

Hex code (or a pure bin file) does not contain any relocation entries, so it can not be used as a source format for dynamic relocation. Even if you try to convert to another format, the resulting file will still not contain any relocation entries.

If the compiler can't produce a file format with relocation entries, you may be able to write a program that scans the assembly list files to extract relocation information.

However, as Andy notes, the C51 chip isn't the usual general-purpose processor. This sounds like a project that will end in sorrow...

Please come back with a description of what end result you hope for.

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

ARM’s Privacy Policy has been updated. By continuing to use our site, you consent to ARM’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.

Acquisition of ARM Holdings plc. by SoftBank Group Corp.

We are pleased to inform you that on 5 September 2016, SoftBank Group Corp. acquired ARM Holdings Plc. ARM will continue to operate as an independent business within the SoftBank group.

Any current agreements between ARM Ltd (or other ARM group companies, as applicable) you / your company remain in effect as between the parties, and the parties will continue to be bound by and perform the obligations in such agreements. If you have any queries please direct these to