How to convert *.elf to *.hex file

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to convert *.elf to *.hex file

Jump to solution
29,206 Views
yuehedeng
Contributor III

Hi,

 

     I'm planning to work on a bootloader project for my MPC5748G. *.elf file can't not be parsed easily, so I want to convert it to *.hex file. Is there any build-in tool in S32 that can do this job?

Labels (1)
1 Solution
19,567 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

you can also create .hex file directly in design studio. Open project properties and C/C++ Build -> Setting. Check Create flash image button and click OK.

pastedImage_1.png

Now open project properties again and choose Standard S32DS Create Flash Image -> General. There are four output file formats and one of these is Intel HEX. Choose HEX and click OK. Build your project once again.

pastedImage_2.png

After the build, hex file is placed in Debug folder.

pastedImage_3.png

Regards,

Martin

View solution in original post

7 Replies
19,568 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

you can also create .hex file directly in design studio. Open project properties and C/C++ Build -> Setting. Check Create flash image button and click OK.

pastedImage_1.png

Now open project properties again and choose Standard S32DS Create Flash Image -> General. There are four output file formats and one of these is Intel HEX. Choose HEX and click OK. Build your project once again.

pastedImage_2.png

After the build, hex file is placed in Debug folder.

pastedImage_3.png

Regards,

Martin

19,567 Views
seunghyunum
Contributor I

Hi,

I'm trying to use the S32K144 chip. When I tried to flash the "bin" file to S32K144, it failed.

Doesn't S32K144 support "bin" type? "elf" and "hex" work well.

pastedImage_1.png

Thank you,

BR,

Seunghyun Um

0 Kudos
Reply
19,567 Views
jackjiang
Contributor II

Hi Martin,

I did what you said, and why did the compiler make a mistake?

2.JPG

0 Kudos
Reply
19,567 Views
yuehedeng
Contributor III

Great! Thank you very much, it works.

0 Kudos
Reply
19,567 Views
BlackNight
NXP Employee
NXP Employee

I'm using the open source SRecord (SRecord 1.64) utility for this and all kind of advanced convertsion and manipulation. It can be called from Eclipse/S32 Design Studio as part of the 'post build step'.

It supports both 32bit and 16bit Intel .hex files:

−Intel

An Intel hex format file will be written. (See srec_intel(5) for a description of this file format.) The default is to emit “i32hex” 32-bit linear addressing; if you want “i16hex” 20-bit extended segment addressing use the −address-length=3 option, if you want “i8hex” 16-bit addressing use the −address-length=2 option.

−Intel_HeX_16

An Intel-16 hex format (INHX16) file will be written. (See srec_intel16(5) for a description of this file format.)

For other usage, see

https://mcuoneclipse.com/2015/04/26/crc-checksum-generation-with-srecord-tools-for-gnu-and-eclipse/ 

https://mcuoneclipse.com/2015/09/23/aligning-s19-records-to-64-bit-boundaries/ 

https://mcuoneclipse.com/2016/02/26/merging-s19-files/ 

I hope this helps,

Erich

19,567 Views
sreevishakhkp
Contributor III

Hi Erich,

As we are trying to generate .hex file, default its generating with record type as Extended segment address( type 2) .We need .hex file with extended linear address(type 4).Please let me know any changes need to be done.

0 Kudos
Reply
19,567 Views
yuehedeng
Contributor III

Thank you. Martin Kovar provides another for S32. If you aslo use S32, you can try it as well.

0 Kudos
Reply