⇥

PRIVATE BROWSER TOOL

Rebase an Intel HEX firmware image

Address relocation changes where bytes are programmed; it does not relink executable code. Use it only when the firmware is position-independent or the relocation is expected by your workflow.

01

Inputs

● Local processing — this file never leaves your browser.
02

Results

⇥

Run the tool to see a structured report here.

ON THIS DEVICE

Recent history

Your latest 10 runs will appear here on this device.

HOW IT WORKS

Method and formulas

The signed offset is added to every absolute data address. Negative results and addresses beyond 32-bit Intel HEX range are rejected.

Accuracy note

Always compare generated firmware with the target device’s memory map, linker output and programming documentation before flashing.

GUIDE

What this tool does and when to use it

Rebasing an Intel HEX firmware image shifts every absolute data address by a user-supplied signed offset while preserving record structure and checksum integrity. Engineers apply this operation when a firmware binary must be relocated within a microcontroller memory map, for example to accommodate a new bootloader base address or to merge multiple images that were originally assembled at different origins. The process operates entirely on the parsed data bytes and their associated 16-bit or 32-bit addresses; no code execution or simulation occurs.

Intel HEX files encode firmware as a sequence of records beginning with a colon, each containing a byte count, address field, record type, data payload, and checksum. Only data records (type 00) carry relocatable bytes; extended segment address (type 02) and extended linear address (type 04) records are recalculated after the offset is applied so that the resulting file remains normalized. The tool rejects any resulting address that becomes negative or exceeds the 32-bit limit of 0xFFFFFFFF, ensuring the output stays within the addressable range supported by most 32-bit microcontrollers and flash programmers.

Worked example with realistic numbers

Consider a minimal Intel HEX fragment that places two bytes at address 0x08001000. The original file contains the record :020000040800F2 followed by :02000000112233. Applying a positive offset of 0x2000 moves the data to 0x08003000. The tool rewrites the extended linear address record to 0x0800 and updates the data record address field accordingly, producing a normalized output that a standard programmer can ingest without further adjustment.

Original addressOffsetNew addressData bytes
0x08001000+0x20000x080030000x11 0x22
0x08001002+0x20000x080030020x33

Negative offsets are handled identically; an offset of -0x1000 applied to the same starting address yields 0x08000000. Any calculation that would produce an address such as 0x07FFFFF0 is accepted, but an offset that drives any address below zero or above 0xFFFFFFFF triggers immediate rejection before any output file is generated.

Formula and method table

InputFormatRangeOutput
Signed offsetHexadecimal or decimal-0xFFFFFFFF to +0xFFFFFFFFAdded to every absolute data address
Original address16-bit or 32-bit0x00000000 to 0xFFFFFFFFNew address = original + offset
Record type 00 payloadByte array1 to 255 bytesUnmodified data copied to new address
Extended linear address16-bit segment0x0000 to 0xFFFFRecalculated from new 32-bit base
new_address = old_address + offset; if (new_address < 0 || new_address > 0xFFFFFFFF) reject;

Units and conversions notes

Offsets may be entered in hexadecimal prefixed with 0x or in plain decimal. The tool converts both representations to a common 64-bit signed integer before addition, then masks the result back to 32 bits for validation. Address fields inside records remain 16-bit quantities; when the 32-bit address crosses a 64 KB boundary the extended linear address record is updated automatically so that subsequent data records use the correct 16-bit offset. No floating-point or fractional units are involved; all arithmetic uses integer addition only.

Limitations

The algorithm rejects any negative address result and any address exceeding 32 bits, preventing generation of files that many device programmers cannot accept. Start-address records (type 05) and end-of-file records (type 01) are preserved unchanged because they do not contain relocatable data addresses. The tool does not reorder records or optimize record lengths; the output file may therefore contain more records than strictly necessary after a large positive offset. Processing occurs locally in the browser; no data leaves the user device.

Common mistakes

Users sometimes supply an offset in the wrong radix, causing an unexpectedly large shift that immediately exceeds the 32-bit limit. Another frequent error is neglecting to verify that the new base address still lies within the target microcontroller flash region, resulting in a valid HEX file that nevertheless fails to program. Applying an offset to an image that already contains extended linear address records without first normalizing can produce duplicate or conflicting segment records; the tool therefore always regenerates these records from the final 32-bit addresses.

LONG-FORM ANSWERS

Frequently asked questions

What occurs when a rebased address lands exactly on 0x100000000?

The tool treats 0x100000000 as beyond the 32-bit range and rejects the entire operation before writing any output file.

How are type 04 extended linear address records regenerated after rebasing?

The tool extracts the upper 16 bits of each new 32-bit address and emits a fresh type 04 record whenever the upper word changes, ensuring subsequent data records remain correctly addressed.

Does the tool modify checksum bytes during address rebasing?

Yes, every record checksum is recalculated from the updated address fields and unchanged data bytes so the output file remains syntactically valid.

What is the largest negative offset that can be applied to an image starting at 0x00001000?

An offset of -0x1000 produces address 0x00000000, which is accepted; any larger negative value yields a negative result and is rejected.

Are start-linear-address records (type 05) altered by the offset?

No, type 05 records contain execution start addresses that are not data locations, so they are copied verbatim into the output.

Can a rebased Intel HEX file contain addresses above 0xFFFF when the original used only 16-bit addressing?

Yes, the tool automatically inserts type 04 records when any new address exceeds 0xFFFF, converting the file to 32-bit linear addressing as needed.

What validation prevents wrap-around when adding a large positive offset near 0xFFFFFFFF?

The comparison new_address > 0xFFFFFFFF is performed with 64-bit arithmetic before masking, so wrap-around cannot occur and the file is rejected.

Does the rebase operation preserve the original record ordering?

Record order is maintained exactly; only address fields and necessary extended address records are updated, avoiding any re-sorting that could affect certain legacy programmers.