This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Intel HEX file and map file

Hello everybody.
I would know if a way exixts to find a match between the map file (where the memory allocation is illustrated) produced at the end of the compilation and the HEX file (that I download on my target).
I mean, the HEX file is composed by HEX records (each line of it) where the 4 hex digits, after the two representing the length, stand for the address.
But I am not able to find a match between these addresses and the one on the map file.
Could anyone help?

I can put the question in a different way, explaining what I should do, in order to have alternative suggestions.
I would edit the HEX file (for example running a script file) generating n-HEX files starting from it, where each one of it has modified a specific variable (for example representing the Identifier of the system where downloading the HEX file). But to do so, I was thinking to put the variable that represents this Identifier in a fixed and known location, then searching it on the HEX file and modifying according to my needs.
But, how I told before, I find the variable on the map file of course, but I am not able to find it on the HEX file.
Thanks to all.

Parents
  • First off, you can't do it with a normal variable, since a variable is not represented in the hex file. The hex file only covers the address range of data placed in the flash (or, for some chips also data stored in EEPROM).

    You must declare your variable as const and stored in the code segment.

    Then you have to realize that each hex line only mentions the address of the first byte on the line. Another thing is that each HEX line only has a 16-bit offset. For processors with more than 64kB of code, there will be special records that points to the start of a code segment to allow the hex file to address more than 64kB.

Reply
  • First off, you can't do it with a normal variable, since a variable is not represented in the hex file. The hex file only covers the address range of data placed in the flash (or, for some chips also data stored in EEPROM).

    You must declare your variable as const and stored in the code segment.

    Then you have to realize that each hex line only mentions the address of the first byte on the line. Another thing is that each HEX line only has a 16-bit offset. For processors with more than 64kB of code, there will be special records that points to the start of a code segment to allow the hex file to address more than 64kB.

Children