Skip to content

23. The Harmony 600's firmware, complete, and checked by its own checksum

The 600's firmware image has been truncated for as long as this project has existed. concordance --dump-safemode returns 65536 bytes of a 70336 byte image, so the last 4800 bytes were missing and with them the entry point at 0x1A26E, which is why every arch 14 disassembly here has used the Harmony 700 2.8 package as a stand in for the remote actually on the bench.

It is read now, off the remote, by this project's own code. 70336 bytes, and the image's own header checksum verifies over all of them.

How, in one paragraph

Arch 14 runs its application from internal flash with an exec base of 0x9000, where arch 12 runs from external NOR. Section 22 established that the internal read window is two 64 KiB pages rather than one. Those two facts together put the whole image inside reach: program 0x09000 to 0x0FFFE through sub-selector 0xFE, and 0x10000 to 0x1A2C0 through 0xFF. That is 1136 reads of 62 bytes, and it takes five seconds.

Why it is believed

Three things, and the first is the one that matters.

The image validates itself. src/harmony/firmware.py already knew the header format and its checksum, from images decoded out of .hfw packages. The size field was read as (size - 8) & 0xFFFF, ambiguous modulo 64 KiB, with candidates 4800, 70336 and 135872 bytes, and only 70336 verifies: stored 0x6A2B, computed 0x6A2B. Section 295 found the field is three bytes, byte 6 being its top, and it states 70336 outright, so the ambiguity was this reader's and not the header's. The closure stands, since it is the checksum that picked the length. The truncated file does not verify at any candidate. A 16 bit checksum over 70 KiB agreeing by chance is a one in 65536 event, and the wrong-length candidates demonstrate what a mismatch looks like.

65534 bytes agree with a dump made by other software. Everything the truncated file can express was re-read off the device and compared: zero differences. Two bytes could not be compared, program 0x0FFFE and 0x0FFFF, because the firmware clamps the read offset at 0xFFC0 and a 62 byte read from there ends at 0xFFFD. Those two are taken from the truncated dump, which is the only place they exist, and they are inside the checksum that verifies.

The recovered tail is plausible on its own terms. 4698 of its 4864 bytes are not erased flash, the last non-erased byte sits at 0x1A297, and the image ends at 0x1A2C0. The entry point the header has always pointed at, 0x1A26E, is inside the recovered region, so the code it names is readable here for the first time.

A defect this exposed in our own tooling

firmware.recover_size resolved the modulo 64 KiB ambiguity by taking the smallest candidate at least as long as the buffer it was given. That is right for a truncated file, which is what it was written for, and wrong for a buffer holding more than the image, which is what a live read of the surrounding memory produces: it answered 135872 for the 600.

It now checks instead of guessing. A candidate that lies inside the buffer can have its checksum verified, so the function tries that first, smallest up, and only falls back to the old rule when no candidate can be checked. Both cases now answer 70336. A heuristic that had a closure available and was not using it is a small thing, but it is the same shape as the mistake in section 22: an answer produced without evidence, in a place where evidence was cheap.

The One, swept in full, and a field that stopped being unexplained

The One's two pages were read the same way afterwards, 2114 reads, ten seconds. There is no second copy of any of it to compare against, because on arch 12 the application runs from external NOR and no .hfw package covers the internal flash. So the checksums are the whole argument, and there are three of them:

Image length version checksum
0xFE +0x1000 45356 3.4 0xDB1C, verifies
0xFF +0x0000 8438 1.6 0xCB09, verifies
0xFF +0xE000 634 3.4 0xD9E9, verifies

Three independent images each validating their own contents. Below the first sits the bootloader, from the reset vector at zero to +0x1000, with no header of its own.

A second Harmony One has since supplied the copy this lacked. Its 0xFE page is byte identical over all 65534 bytes and its 0xFF page differs in 39 bytes, all of them inside the three regions predicted in advance: the identity block, two bytes at +0xF582 and seven at +0xF643. So these pages are firmware rather than per unit state that happens to look like code, which is a claim one remote could not support however well its checksums verified.

That middle row places version block field 9. Section 4 of docs/usb-protocol.md had it as unexplained, with the remark that 0x16 on the One "is the only value in the block that has no counterpart anywhere in concordance's output". True, and the counterpart was never going to be in concordance's output: it is in the remote. The image at 0xFF +0x0000 carries 0x16 in its header's version byte, which is a distinctive value in a block otherwise full of 0x34. The 600 has no image at that address, only zeros, and its field 9 is 0x00.

Field 8 behaves the same way, 0x34 on the One against 0x00 on the 600, and the One has two more images versioned 0x34. Neither of their addresses has been read on the 600, so the obvious test is two reads.

The 600's own pages, and a recovery path that was not what it said

Both of the 600's pages were swept in full afterwards, which finished the map and turned up two things worth more than the bytes.

Field 8 fell out of it. The section above left field 8 open with a named test: the One has images versioned 0x34 at 0xFE +0x1000 and 0xFF +0xE000, the 600 reports 0x00, so read those two addresses on the 600. The 600 has a safe mode image at 0xFE +0x1000, 24320 bytes at version 0x02, checksum verifying, and nothing at 0xFF +0xE000. So field 8 is the version of the image at 0xFF +0xE000, exactly parallel to field 9 and the image at 0xFF +0x0000. The alternative is refuted rather than merely unfavoured: a field naming the safe mode image would read 0x02 on the 600.

That closes "fields 8 and 9 of the version block", which has been on the open list since the block was first read.

And -safe.bin does not mean the same thing on the two architectures. The safety rails in CLAUDE.md name the per unit *-safe.bin as the first recovery path. On the One that file is flash 0x000000 to 0x010000, it contains the safe mode GSPM container at 0x002000, and it has now been verified against the device byte for byte. On the 600 the file with the same suffix is the application firmware from program 0x9000, truncated at 64 KiB, byte identical to the file this project already called 600-0.2-code-base0x9000-TRUNCATED64k.bin. It is not a safe mode image and it never was.

The 600's actual safe mode is the 24320 byte image at internal 0xFE +0x1000, which nothing had read until now, because arch 14 keeps safe mode in internal flash where arch 12 keeps it in external NOR. A rail that said "restore from the safe dump" would have restored the application over the application and left the recovery path untouched. The rail is corrected and the image is in the lab.

Both 0xFF pages, counted rather than looked at

Writing the two memory maps needed a complete list of what is in those pages rather than a list of the addresses somebody had thought to look at, so the non-erased runs were counted by a script. That is the "count programmatically, never by eye" rule applied to a region this project had already declared mapped, and it found regions nobody had named.

Every run of non-0xFF bytes, with runs closer together than 64 bytes merged, since the read granularity is 62:

Offset in the 0xFF page Harmony One Harmony 600
+0x0000 8438, an image, version 1.6 41624, the tail of the application
+0xE000 634, an image, version 3.4 absent
+0xEC00 absent 121 bytes, unidentified, the settings store since section 282
+0xF400 64, the identity block 48, the identity block with its fourth field erased
+0xF580 4 4
+0xF5C0 2, unidentified absent
+0xF640 11 12
+0xF6C0 absent 4, unidentified
+0xF735 absent 3, unidentified
+0xFFF8 6, the configuration words, section 25 6, the configuration words, section 25

Everything else in both pages is erased. The bolded rows were new when this section was written and nothing here said what any of them were.

+0xFFF8 is settled now, in section 25, and this paragraph used to get it wrong. It read: "on a PIC18 J-series part the configuration words sit at the top of program memory, but not of this page, so the resemblance is a prompt to check rather than a reading." The second clause is false. 0xFE maps from program address zero, so 0xFF is the high half and 0xFF +0xFFF8 is program 0x1FFF8, which is exactly where the configuration words are. The hedge came from not carrying the page mapping through the arithmetic, one section after establishing it.

And the 600's identity block measures 48 non-erased bytes against the One's 64, which is not a disagreement: the One's fourth field is sixteen zero bytes and the 600's is erased, so both hold three GUIDs and an unused fourth slot.

The two Harmony Ones agree on every run above, including the lengths of the unidentified ones, and differ only inside +0xF400, +0xF582 and +0xF643.

What it does not settle

MCU_ID is still out of reach, per section 22, so the arch 12 part number stays inferred. The last two bytes of every page are unreadable, because the offset clamps at 0xFFC0 and 62 bytes from there end at 0xFFFD; no image runs that far, so nothing here depends on them. And the 700 2.8 image remains worth keeping: it is a second arch 14 sample and the only one for that model.


Section 22 | the archive | section 24. Section 23 of the findings archive, which is frozen; the reference holds the current answer. The archive on GitHub.