How to convert *.elf to *.hex file

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to convert *.elf to *.hex file

跳至解决方案
25,449 次查看
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?

标签 (1)
标记 (2)
1 解答
15,810 次查看
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

在原帖中查看解决方案

7 回复数
15,811 次查看
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

15,810 次查看
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 项奖励
15,810 次查看
jackjiang
Contributor II

Hi Martin,

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

2.JPG

0 项奖励
15,810 次查看
yuehedeng
Contributor III

Great! Thank you very much, it works.

0 项奖励
15,810 次查看
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

15,810 次查看
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 项奖励
15,810 次查看
yuehedeng
Contributor III

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

0 项奖励