About HEX file generated by MCUXpresso IDE

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

About HEX file generated by MCUXpresso IDE

2,396 Views
T2
Contributor III

Hello,

 

I added post-processed command 'arm-none-eabi-objcopy -O ihex ***.axf ***.hex'.

I was able to generate a HEX file (intel hex) after build process.

 

But, I have a question.

I checked the generated file according to the intel hex format.

 

Memory locations are incompatible.

For example, get the address of a variable from a MAP file.

This address does not exist in the HEX file.

 

Is this the correct state?

Or is there another way to generate HEX file?

 

Best regards.

0 Kudos
Reply
7 Replies

2,060 Views
ArmandoPinedaM
Contributor I

Hi!
Hope this helps.
In Hex files the format is is:
:10ECC00000008100000003000500010001000100B8

Number of data

Addres to place that data

Type of data (00=program/data)

Data

Checksum

As you can see the Addres of the data uses only 4 characters, so the max addres you can represent on a Hex file is 0xFFFF.

But if you have some information on your memory with an addres like this 0x0007f000 which is 5 characters long it is placed on the HEX file using this "command":

:0200000270008C

Number of data

Addres to place that data (in thi case 0x0000 because it is a command)

Type of data (02=new data sector)

Data (in this case the new sector that is going to be used)

Checksum

This "command" declares that the following parts of the information is going to be placed after the segment with addres 0x70000. So the Hex file continues from that addres.

:10ECF0007017B80B8813A8165C127C1508000A0050

This line has the addres 0xF000 but is after sector 0x7000 so the data is placed on addres 0x7F000.

 

Best regards.

0 Kudos
Reply

2,382 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello T2,

Just one supplement, you can also generate HEX file as below:

Alice_Yang_0-1663744756988.png

 

 

BR

Alice

 

0 Kudos
Reply

2,360 Views
T2
Contributor III
Thank you for your information.
0 Kudos
Reply

2,390 Views
ErichStyger
Specialist I

I think you have a misunderstanding what the HEX file is:

The HEX file only contains code and constant data, not variables.

see https://mcuoneclipse.com/2017/03/29/mcuxpresso-ide-s-record-intel-hex-and-binary-files/ and especially https://mcuoneclipse.com/2012/09/27/s-record-intel-hex-and-binary-files/

I hope this helps,

Erich

0 Kudos
Reply

2,380 Views
T2
Contributor III

Thank you for your reply.

 

I understand about the information in the HEX file.

By the way, is it correct to understand the information in the file generated by the MCUXpresso IDE as follows?

.axf : Code, Constant data, Variable

.map : Constant data, Variable

.hex : Code, Constant data

 

I am trying to do XCP communication with CAN.

A HEX file was required for XCP communication, so I used a file generated by the MCUXpresso IDE.

However, an error occurred when measuring the variable.

Therefore, I thought that the HEX file did not have variable information, so I asked a question.

 

Do you have any knowledge about XCP?

Any information would be appreciated.

 

Best regards.

0 Kudos
Reply

2,371 Views
ErichStyger
Specialist I

.axf is just another extension for what otherwise .elf is used. It is an ARM Executable File format in ELF/Dwarf format: Code, data, relocation sections, debug information, etc

See https://en.wikipedia.org/wiki/DWARF and https://en.wikipedia.org/wiki/Executable_and_Linkable_Format

.map is a text file generated by the GNU ld (linker), it is a documentation file in text format.

.hex is a file format in textual representation describing memory addresses with their (constant, for the case of embedded systems) data content, so it can be used by bootloaders or programmers.

I hope this helps,

Erich

0 Kudos
Reply

2,353 Views
T2
Contributor III
Thank you for your information.
0 Kudos
Reply