Creating HEX file fromt the ELF file from command line

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AnRa_1522781
Level 2
Level 2

Hi,

   

I would like to extract the HEX file that can be flashed with PSoC programmer from the generated ELF file. 

   

Is cyelftool.exe the tool to do it?  

0 Likes
4 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi,

   

Why do you need to create HEX file from ELF file. Creator creates both of them together actually. Please let us know what prevents you from using the hex file created by PSoC Creator ?

Best Regards,
VSRS

0 Likes

Hi VSRS,

   

We are evaluating a static and dynamic analysis tool for our code. The tool needs to be run on the command line. So for software testing we build the code on the command line. The target based testing can be done if we get the instrumented code on the target. So we need to know all the steps and build from command line.

   

-arptt

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi,

thanks for the clarification. As NJAY mentioned objcopy -j .text -j .data -O ihex <input-file.elf> <output-file.hex> will do the job. Make sure you are running it in an elevated command prompt.

Best Regards,
VSRS

0 Likes
user_284806
Level 2
Level 2
First like given

Try the (GNU/GCC toolchain) tool objcopy, something in the lines of

   

objcopy -j .text -j .data -O ihex <input-file.elf> <output-file.hex>

0 Likes