Checksums
[verified]: six checksums, all matching on every available dump (16 public 0110C6 images, two 512 KB reads and one 32 KB calibration of a 0110AD ECU; see results). Three are the CRC-16s the MS4x community documents and nfsx (ms4x-checksum.ts) implements. The other three were found while building this wiki:
- a word sum over boot block 2 (the MS43 one has the same form);
- a per-module XOR-16 table in boot block 2;
- a CRC-16 on each EEPROM-emulation record.
All values are little-endian. Region tables hold ECU addresses as (lo u16, hi u16) pairs. On MS42 these equal file offsets (see Memory map).
Algorithms
- CRC-16: reflected polynomial
0xA001(the CRC-16/ARC table; nfsx calls it "CCITT 0x1021 bit-reversed", which is the same table), init = a seed read from the image, no final XOR. One running CRC is chained over all regions of a checksum. Region ends are inclusive. - add-32: Σ u16 LE words, mod 2³².
- XOR-16: XOR of u16 LE words.
The six checksums
| # | Name | Kind | Result at | Metadata | Covers (0110C6) | Checked by |
|---|---|---|---|---|---|---|
| 1 | Boot | CRC-16 | 0x03C24 u16 | count 0x3C26 (=1), start 0x3C28, end 0x3C2C; seed u16 at 0x3FE6 (0x2D2D) | 0x00000–0x03C23 | boot 0x0B00 |
| 2 | Program | CRC-16 | 0x50306 u16 | header 0x502CE → result 0x50306, seed pointer 0x502D2 → 0x50032; count 0x50308 (=7) + 7 × 8-byte table | 0x500A4–0x50305, 0x50342–0x52EFD, 0x60000–0x60C43, 0x70000–0x7EC65, 0x11000–0x1FFFD, 0x20000–0x2FFFD, 0x30000–0x3FFFF | boot 0x0CD6, program 0x1C2B0 |
| 3 | Calibration | CRC-16 | 0x4FEE0 u16 | header 0x502F2 → result 0x4FEE0, seed pointer 0x502F6 → 0x4800C; count 0x4FEE2 (=1) + 1 × 8-byte table | 0x48000–0x4F843 | boot 0x0E88, program 0x1C3C8 |
| 4 | Boot block (add) · new | add-32 | 0x0BFF8 u32 | none; init 0 | 0x08000–0x0BFF7 | not located |
| 5 | Boot modules (xor) · new | XOR-16 × 39 | 0x0B806 + 8n u16 | table 0x0B800: (id, start, length, xor) per entry, 0xFF00 ends | each module [start, start+length), together 0x08402–0x0B5BB | boot block 2 0x8358, after copying the module to XRAM 0xE000 |
| 6 | EEPROM records · new | CRC-16 per record | record +0x3FE u16 | length u16 at +0x3F6; init 0x000F | each 1 KB record in 0x4000–0x7FFF, [record, record+length) | program 0x75DB2 (0110AD 0x72B7E) |
0110AD differences: same offsets and the same tables. The ranges come from the tables in the image: Program 0x50342–0x52E83, 0x60000–0x60C1F, 0x70000–0x7B815, 0x11000–0x1FFFB, 0x20000–0x2FFFB, 0x30000–0x3FFFD; Calibration 0x48000–0x4F8C7; modules 0x083EA–0x0B4B9; record length 0x2EE. [verified]
Notes:
- Seeds are ASCII. Boot uses
"--". Program uses"00"/"10"inside the program ident. Calibration uses"C6"/"AD", the last two SW digits. The #6 init0x000Fis an immediate in the CRC routine (MOV R4, #0xF), not an image field. nfsx's prose doc (raw-ds2-flashing.md§5.4) gives the Boot seed as0x3FF6. Its code and the boot code read0x3FE6. - Order: #5 lies inside #4, so fix the module XORs first, then the word sum. No other checksum's result lies in another's range. In particular the Program CRC result (
0x50306) sits between its first two regions. - #4 and #5 protect boot block 2, which DS2 never writes. They only matter for bootmode images that edit
0x8000–0xBFFF. The #4 stored value matches Σ words on both builds (0x11AF446A/0x11D3946D), whose code differs in 79% of bytes. That rules out chance. The code that checks it was not found. - #6 guards the ECU's own adaptation records. The ECU rewrites these at run time, and a tool only needs them when it edits the EEPROM area of a bootmode image.
- Block markers
90 48 24 42at0x50000and42 24 48 90at0x4FFF0are not checksums. They are fixed valid / erased flags that the boot code tests (see Memory map). - Not covered by any checksum:
0x3C24–0x3FFF(CRC block, UIF, ISN, factory idents),0x8000–0xBFFFoutside #4,0x50000–0x500A3(marker,0x5002Cflag, program ident),0x50306–0x50341(Program CRC block),0x52EFE–0x5FFFF,0x60C44–0x6FFFF,0x7EC66–0x7FFFF,0x48000–past0x4F843(patch value area0x4F844+, the CRC block,0x4FEFE, the marker).0x40000–0x47FFF,0x10000–0x10FFFand0xC000–0xFFFFare never covered.
Calibration-only files
A 32 KB file (file 0 = ECU 0x48000) carries checksum #3 completely. Its result and region table are at 0x4FEE0 (file 0x7EE0) and its seed is at 0x4800C (file 0x000C). The header pointers live in the program (0x502F2/0x502F6). For a 32 KB file the tool uses the values those pointers hold in every known image. nfsx does the same.
Disabling checks
- Checksum Bypass (patchlist):
0x4FEFE0000 → FFFFand0x5002C00 → A8. The boot skips the calibration CRC when0x4FEFE == FFFF(0x0E9A). The program then accepts the skip only if0x5002C == A8(0x1C3C8–0x1C3F6). Otherwise it sets the error bit. [verified code] Both bytes are outside every checksum. 0110AD has the same base bytes, identical boot code, and both program tests (byte patternsMOV R4, 0xBEFEat0x1ADE2andMOVB RL4, 0x402C; CMPB RL4, #0xA8at0x1336C), so the bypass should work there too. Not tested on a car. [inferred for 0110AD] - Checksum Bypass (Full) (patchlist, "Live Tuning Helper"): replaces the five compare branches (
JMPR cc_NZ→NOP). Three are in boot (0x0B72Boot,0x0CE6Program,0x0EB0Calibration) and two in the 0110C6 program (0x1C2B8,0x1C3DA). The boot edits fall inside the boot sector, which only bootmode writes, and inside the Boot CRC range (harmless once its compare is gone). The program addresses are 0110C6-only. See Patchlist.
Tool
ms42_checksum.py (Python 3, no dependencies) verifies and fixes all six checksums in a 512 KB image, or #3 in a 32 KB calibration:
python3 -I ms42_checksum.py dump.bin # verify, exit 1 on mismatch
python3 -I ms42_checksum.py dump.bin --fix # rewrite stored values in place
python3 -I ms42_checksum.py dump.bin --json # machine-readable report--fix writes the module XORs first, then the word sum, the EEPROM records (only records whose header is consistent), Boot, Program and Calibration. It was tested by corrupting one byte in each covered region of a 0110C6 and a 0110AD image (boot code, EEPROM record, a boot-block module, boot block outside the modules, program 0x20000 and 0x70000, calibration). In every case the corrupted image failed, --fix made it pass, and undoing the edit and fixing again restored the original byte for byte. Fixing a 32 KB file gives the same bytes as fixing the same edit in the 512 KB image. Log: fixtest.txt.
Results
| File | SW | Boot | Program | Calibration | Boot block | Modules | EEPROM |
|---|---|---|---|---|---|---|---|
16 × Siemens_MS42_0110C6_*.bin | 0110C6 | DF13 ✓ | F347 ✓ | per file ✓ (15 distinct) | 11AF446A ✓ | 39 ✓ | 10 ✓ |
MS42_private_0110AD_512K.bin | 0110AD | DF13 ✓ | C175 ✓ | B796 ✓ | 11D3946D ✓ | 39 ✓ | 8 ✓ |
MS42_private_0110AD_512K_jmg.bin | 0110AD | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
MS42_private_0110AD_32K.bin | 0110AD | — | — | B796 ✓ | — | — | — |
Every dump passes. The JMG read differs only at 0x3F01–0x3F63, which no checksum covers. Per-file values: data/dumps.json.
How the new ones were found
- Stored-value scan. Every u16/u32 in a non-
FFarea was tested against sum16, −sum16, xor16, sum32, −sum32, sum32 +0xA5A5A5A5and byte-sum32 of the words before it. The candidate starts were every0x1000boundary and every non-FFrun edge, up to 64 KB back. A hit counts only if it holds at the same range in images whose covered bytes differ. With that rule only one hit survives: #4 at0xBFF8. All 16-bit hits in bytes shared by every dump are chance matches. - Code reading. The loader in boot block 2 looks modules up in the table at
0xB800and XORs each one after copying it (#5). The program's only CRC table (0x52CF2) has a second user besides the Program and Calibration checks: a routine with an immediate init0x000F(#6). The record trailer matched it once the length word at+0x3F6was taken as the range: 18 of 18 records on both builds.
Searches that found nothing: a CRC-16/ARC with any init over [record, record+len) before the length was known; CCITT-false/XMODEM over the module ranges; any second CRC table in either image.