Electronic – Understanding data holes in a Intel HEX file

hex filemicrocontroller

I am working on a secondary bootloader for a Renesas microcontroller.
Following are two consecutive records of the 11000+ records in the HEX file.

:04D1D000000000005B
:10D1DC0001030600001000000080000000000100A8

Decoding this the simpler :LLAAAATT way:

:04D1D000000000005B means:

  • Length of data: 0x04 bytes
  • Address to put data at: 0xD1D0 + Base address set previously, in this case it was 0xA0000
  • Record type: 00 Meaning, its a Data record.
  • Data: 00000000 which is 0x00, 0x00, 0x00 and 0x00 when represented as bytes.
  • Checksum of the record: 0x5B

:10D1DC0001030600001000000080000000000100A8 means:

  • Length of data: 0x10 bytes
  • Address to put data at: 0xD1DC + Base address set previously, in this case it was 0xA0000
  • Record type: 00 Meaning, its a Data record.
  • Data: 01030600001000000080000000000100 which is data that should be programmed from location 0xAD1DC
  • Checksum of the record: 0xA8

If we look at the addresses, we know what data is to be programmed from 0xAD1D0 to 0xAD1D3 which is 4 bytes. And we know, what data is to be programmed from 0xAD1DC to 0xAD1EC which is 16 bytes.

What should the memory between 0xAD1D4 to 0xAD1DB (both inclusive) which is 8 bytes be filled with? Is it 0xFF or 0x00?

I checked that these locations have no special significance and are not reserved locations as such.

Best Answer

Intel Hex specifies the bytes to be programmed and their new values. All other bytes are keep their previous state. If you are programming a blank part, that previous state is its unprogrammed value.

Intel Hex is targeted at programmable (non-volatile) memories. Nearly all programmable memories used over the last decades are EPROM variants, such as Flash. Their unprogrammed value is almost always 0xFF. Note that the datasheet must always be used to obtain the actual unprogrammed value for your part. As with any characteristic, it should not be assumed.