Skip to content

Research notes ​

Provenance, method and open questions behind the layout pages and the XDFs. Written 2026-11-29.

Sources ​

SourceWhat it contributed
Bartek0x00/BMS46-Wiki (MIT)maps.json (239 named/located map structs), variables.json (253 RAM variables with factor/offset/unit), notes.c (decompiled lookup routines, RAM addresses, DS2 status codes), map viewer (struct format), checksum.py (CRC-16/ARC), 10 full + 8 partial dumps, decompiled SGBD (bms46d15.c), WinOLS packs, a Ghidra project (needs Ghidra ≥ 12; this analysis used a fresh 11.3.1 import)
a private 01119700F000Q28G full dumpFull 256 KB dump, 16-bit byte-swapped. Un-swapped it is calibration 01119700F000Q28G: cal identical to the wiki Q28G, 28 program bytes differ, boot area blank. Program + cal CRCs valid. This is the reference used to generate the XDFs
e46 87kw.bin partial dump32 KB partial dump, byte-identical to the wiki's PARTIAL_01119700F000Q2AG.bin. The wiki's m43b19org.ols WinOLS project was created from a file with the same name
XeTK/BMW-BMS46-Flasher (flasher.py)DS2 0x06 reader only (no write path). Basis of the read-only BMS46 profile in @emdzej/nfsx-directmode

No firmware binaries are published here; only the wiki's JSON definitions (with licence) are vendored under data/.

Method ​

  1. Fingerprinting: MD5 + ident strings of every dump; blank-run (FF) analysis to find region boundaries and dump coverage.

  2. Partial alignment: slid each partial dump over its matching full dump. Every pair aligns at ROM 0x8010 (6 identical; the Q22I pair differs in 868 bytes, i.e. two different dumps of the same SW).

  3. Ghidra (11.3.1 headless): imported reversed.bin (= 01119700F000P2AG, the wiki's RE target, which has a populated boot sector) as 68000:BE:32:MC68020 (raw binary), seeded disassembly from both reset vectors, ran auto-analysis (728 functions), then scripted a scan for instructions referencing 0x3D20 (CRC table), 0xFFFA, 0x3FFFC, 0x8000, 0x3FE6, 0x5AA5 and decompiled the hits. Key functions:

    AddressRole
    0x3254CRC-16 inner loop over [start,end], writes 0xAA to SWSR 0xFFFA27 (watchdog)
    0x314ACRC descriptor-table walker (16-byte records, 16 KB slices, running CRC per group, result bitmask)
    0x30E8Picks descriptor table 0x14200 (program valid) or boot fallback 0x3D00
    0x3002Calibration marker logic (0x8000 / 0xFFFC)
    0x34FAProgram ↔ calibration compatibility (ident, Kennung, CondComp strings)
    0x3656Boot → application hand-off when the program is valid
  4. Checksum model reconstructed from (3) and confirmed numerically on all dumps (table in Checksums).

  5. Map validation: parsed every maps.json entry as a struct (pointer prefix 0x00FF, dimensions equal to size_x/size_z, no overlaps, every pointer resolvable in variables.json) on every dump. This gives the compatibility table in Variants.

  6. Scaling sanity: decoded representative maps with variables.json factors. RPM axes come out 520–6000 rpm, base ignition 23° → 4° with load, coolant/IAT tables as plausible NTC curves (5.4 V → −40 °C, 0.2 V → 144 °C), torque 0–150 Nm.

  7. Tuned-vs-stock diffs: attributed every changed byte in the wiki's tuned files to a map/axis/data region. This gives the "most tuning-relevant maps" list.

  8. XDF round-trip: decoded every table through the generated XDF itself (addresses, element size, rows/cols, MATH) for the full XDF on a full Q2AG dump and the partial XDF on e46 87kw.bin. 238/238 shared tables are identical, and dimensions match the struct decoder. Both XDFs also parse cleanly with tunex's @tunex/xdf-parser.

Corrections to earlier assumptions ​

  • The BMS46 is MC68336 (CPU32), not a C167 like MS41/42/43. None of the MS4x memory maps, checksums or bootmode tooling in nfsx apply.
  • The flipped option in flasher.py exists because some images circulate byte-swapped. The ECU's own DS2 0x06 response is in natural (big-endian) order.
  • Supplier attribution is inconsistent: WinOLS packs label it Bosch, while BMS4x is often attributed to Siemens. Unverified; nothing here depends on it.

Open questions ​

  • Write path: mostly solved statically (2026-11-29). See Flashing: boot DS2 table 0x36B6, AMD/JEDEC flash driver copied to RAM, seed/key fold, and the 0x91 baud change. Still open: bench-verify the key algorithm and the 0x07 sub-mode sequence.
  • Unnamed variables. All 239 maps are now named. Some RAM variables, mostly intermediate values, are still raw.
  • Scalars between maps (65 gaps, 1947 bytes, e.g. 0x85B0–0x85ED, edited by a tuner) and the 1153-byte block at 0xA9E1. Rev limiter and speed limiter are probably there. notes.c mentions "Engine_RPM Med vs High limit (6200 RPM) 0x917f", but the byte at cal 0x917F doesn't decode to 6200 rpm with any known scaling, so it isn't included.
  • NV sectors 0x4000–0x7FFF. Format and meaning are unknown (adaptations / fault memory suspected).
  • Boot area readability. Why do half the dumps return FF for 0x0000–0x7FFF: dump-tool range, or a DS2 read restriction (the read handler has a range check, check_in_range in notes.c)?
  • EF00 family: mapped (2026-11-29). See Variants. Only one EF00 calibration has been checked.

Second-pass review (2026-11-29) ​

All medium- and low-confidence names were re-checked in an independent Ghidra project:

  • Confirmed: 48 of 56 names.
  • Renamed: 8, all in one group. RAM byte ff8478 is an ignition offset (FUN_00017314: ign = 8489 + 8478 + 8419 − 60 − …, 30 = neutral, 0.75°/bit), not an idle-air index. The warm-up maps 0x8D3A–0x8E68 and 0x8EA6 are therefore cold-start ignition retard maps (catalyst heating); the ICV maps only add air to compensate.
  • Corrections: all 12 earlier corrections to Bartek names were confirmed and are now applied. Each page shows Previously named ….
  • 0x98BC is not dead. movea.l #0x98D0,A1 at 0x2ACB2 points at its data area, not the struct start, which is why reference scans missed it. The routine copies the 9 bytes into the catalyst monitor's per-cell learned offsets at power-up and on fault-memory clear. It is now named Catalyst_Monitor_Cell_Adapt_Init.
  • Open: the throttle×RPM load model (0x8FF0/0x9048) is computed, but nothing in Q28G reads its output. ICV_Correction_No_AC is used only with A/C on, so it is probably misnamed.

Reproducing ​

bash
# regenerate XDFs + maps.md from a natural-order full F000 dump
python3 -I tools/gen_xdf.py /path/to/01119700F000xxxx_full.bin

# un-swap a byte-swapped dump
python3 -I tools/bms46_checksum.py swapped.bin --unswap natural.bin

gen_xdf.py refuses to run unless every map struct in the reference agrees with data/maps.json.