Format:Intel HEX
| On this wiki | Facts · Code · Notes · Topics |
|---|
ASCII hex firmware format (.hex): lines starting ':' with byte count, 16-bit address, record type (00 data, 01 end of file, 02 extended segment, 03 start segment, 04 extended linear address, 05 start linear address) and a two's-complement checksum.
Overview
Each record is : followed by ASCII hex bytes: LL (data length), AAAA (16-bit address), TT (record type), data, CC (checksum = two's complement of the sum of all preceding bytes). Files are text with CR LF or LF line ends.
Record types
00 data; 01 end of file (:00000001FF); 02 extended segment address (data is a 16-bit segment, base = value << 4); 03 start segment address (CS:IP, 8086); 04 extended linear address (data is the upper 16 bits of a 32-bit address, so :020000040800F2 sets base 0x08000000); 05 start linear address (32-bit entry point, e.g. Cortex-M images do not need it). The python intelhex library (BSD-3-Clause) writes types 02 (line 1196), 04 (1218) and 05 (1228) as such.
Reversing
Convert to a binary with the load address from the type 04 records, then treat it like any flat image: for Platform:ARM Cortex-M the first words are the vector table. Bootloaders and application are often merged into one file with gaps.
Code & repositories
- https://github.com/bialix/intelhex @
bdc202f437ab084036699d4cc9857d0844cd2dbe· license: BSD-3-Clause (read from LICENSE.txt; GitHub's API was busy)
Python Intel HEX reader/writer (BSD-3-Clause).
Tested on: source read, not run: read · checked 2026-10-18 - https://github.com/eerimoq/bincopy @
57bb6cb1d56460fe1df3d30d317b2bfc260ae359· license: MIT (read from LICENSE; GitHub's API was busy)
Python library for S-record, Intel HEX, TI-TXT and binary conversion (MIT).
Tested on: source read, not run: read · checked 2026-10-18