1

I need to get .hex file from eclipse c++ compiler. I received only .elf file. Eventually, I should write that binary code into controller which can adopt only binary code.

I converted the .elf file to binary file using an utility, but it's not the way.

Oh, I forgot to say that I used atollic truestudio.

3 Answers 3

2

First of all Elf is "binary" file (you probably mean compiled executable). You can load that to controller using jtag/debugger. With GNU toolchain you can use objcopy to convert .elf to raw binary. Objcopy can be added as another compilation step in Eclipse/cdt, but probably your IDE provider should do this (check if there is no option to enable this already there).

1

For Intel 32 bit Hex: fromelf -i32 Main.axf > Main.i32

For Motorola 32 bit hex: fromelf -m32 Main.axf > Main.m32

For Verilog byte oriented hex format: fromelf -vhx Main.axf > Main.vhx

For plain binary: fromelf -bin Main.axf > Main.bin

0

For Eclipse(based) C/C++ IDE you can set "Output format" under Project -> Properies window in C/C++ Build > Settings

[x] Convert build output

Where you can select "Inter hex" or "bin"

Pics for similar setting see mcuoneclipse blog.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.