Hi there,
I'm working on a bootloader that uses a hex file.
What does this row do?
:0400000508000131BD
It breaks up to these:
: Start code 04 Byte count: 4 0000 Address 05 Record type: Start Linear Address Record 08000131 <--- is this a start address? BD Checksum
Does it say the execution start (IP) address is 0x08000131? My main program range is from 0x08000000 to 0x0800261. Or should I discard the line altogether?
Thanks. -Mad D
No. The Intel Hex format isn't just a format for encoding the data - also a format for encoding the start address for use by a loader.
Well, the address information in the Hex records tells whatever's handling those records where to put them - but it says nothing about the significance of those addresses, nor whether the records represent "code" or "data"...
No. The specific records: 03 Start Segment Address Record 04 Extended Linear Address Record 05 Start Linear Address Record doesn't encode data. They encode meta-data. In this case the start address of the binary.
If just flashing a device, they get thrown away. But when fed to a loader, they are used to set up the program counter (and optionally a code segment register, in case of a 8086 segmented address space).
"They encode meta-data. In this case the start address of the binary."
Yes - that's exactly what I said.
"But when fed to a loader, they are used to set up the program counter"
That's an interpretation applied by the Loader - the Hex format itself gives no significance whatsoever to the address or the data.
eg, as noted above, the loader might load the initial PC direct from that address, or indirectly - using it as a "pointer to" the actual start address.
The Hex file itself knows nothing of this - it is all down to the loader, and the tools that created the file...