XDF coverage against the code
Draft. This page asks whether the community 430069 XDF (Siemens_MS43_430069_512K.xdf, 3,703 items, all in the calibration) covers every calibration item that the 430069 program actually uses.
Short answer: almost. The XDF covers every map and curve the code reads except 5 small tables and their axes (229 bytes in total, most of them scalars and checksum or ident fields). It has one wrong axis address, one axis with the wrong length, and 4 scalars whose size disagrees with the code. Only 7 XDF items have no code reference that could be found.
Method
The program was disassembled with an independent C166 disassembler (to be published separately). Code structure describes the memory model, the code discovery and the lookup library. Next, tools/c166_analysis.py runs a constant-propagating dataflow pass over every basic block, with DPPs and EXTP/EXTS tracked. It records:
- scalar: every
memor[Rw+#d]operand that resolves into the calibration (file0x70000–0x7FFFF), with its access width. - axis / curve / map: every call to one of the 32 lookup routines, with the far pointer or descriptor resolved. Axis lengths are read from the axis count in the data. Table dimensions come from the axis searches in the same flow, or from the descriptor.
- dtc-code (inferred): the four-pointer fault-path records.
- weak references (extent unknown): far pointers in constant data, pointer arguments,
[Rx+#base]array bases, and near-to-far conversions.
The output is data/code_refs.json, keyed by file offset. It holds 4,295 references in the calibration. tools/xdf_coverage.py parses the XDF (XDFTABLE/XDFCONSTANT/XDFFLAG/XDFPATCH; BASEOFFSET 0x70000 is added to every mmedaddress; linked and embedded axes are resolved) and writes data/coverage.json. The coverage step needs only the JSON, not the disassembler.
Status labels: verified means read in the disassembly or decoded from the bytes. Inferred means pattern- or heuristic-based.
Numbers (430069)
| Count | |
|---|---|
| Lookup call sites resolved | ~2,880 (16 unresolved, all in 0x0B5004–0x0B5F36, pointer taken from [R6+#0x0E] records) |
| Distinct maps / curves / axes / lookup descriptors | 373 / 453 / 599 / 265 |
| Distinct scalar addresses read | 1,635 (1,059 u8, 576 u16) |
| DTC code words (fault-path records) | 644 |
| Code references not covered by the XDF | 45 (229 bytes) |
| XDF items with size or dimension disagreements | 6 |
| XDF items with no reference at all | 7 (plus 42 reached only through weak references) |
(d) Byte coverage of the calibration
Total size is 65,536 bytes, of which 49,241 are not 0xFF.
| Bytes | All | Non-0xFF |
|---|---|---|
| In an XDF item | 45,242 | 44,285 |
| Read by code (known extent) | 40,540 | 39,561 |
| Both | 39,514 | 38,599 |
| XDF only | 5,728 | 5,686 |
| Code only | 1,026 | 962 |
| Neither | 19,268 | 3,994 |
Most of the "XDF only" bytes are tables that the code reaches through pointer records whose extent cannot be measured statically: the per-cylinder knock windows, ip_maf_vo_*, ip_ti_cop_nr_*, and the 512-byte MAF/SAF linearisation tables. Most of the "code only" bytes are axis count headers. The XDF axes start after the count, so this is expected. The non-0xFF "neither" bytes are mostly the ident and checksum blocks and padding between objects.
(a) Code-referenced items the XDF does not cover
| File | Kind | Shape | Routine / user | Values | Guess |
|---|---|---|---|---|---|
0x7BB8E, 0x7BBBE | map ×2 | 6×4 u16 | 0D049A from 0x0B7B40 | first all 0xFFFF; second 16000…5500 | Lambda-heater diagnosis thresholds. The same function reads c_lshpwm_min_diag, c_r_ls_min_diag and c_temp_cur_on_down_ls_max. Two maps, probably one per sensor or bank |
0x754F6/0x7550E and 0x75504/0x7551C | axis ×4 | 6 and 4 u16 | same descriptors | 24536…40552 (step 3203); 12000…21000 | The axes of the two maps above. The second axis looks like battery voltage in mV |
0x7EB74 | curve | 8 u16 | 0D022A from 0x0BDD88 | 7367, 2499, 987, 460, 395, 263, 329, 329 | Rough-road detection. The function reads c_vs_min_rr, c_vs_max_rr and c_wheel_grd_crlc_rr |
0x78481, 0x78487 | curve ×2 | 6 u8 | 0D0262 from 0x0C2B2C | 0…0 / 254…254 | Coolant-temperature plausibility. The function reads c_abc_inc_tco and c_t_tco_sub_is_1 |
0x74833 | axis | 6 u8 | 0D0060 | 51…144 | Axis of the two curves above, apparently a coolant-temperature scale |
0x749D1 | axis | 5 u8 | 0D05B2 descriptor at file 0x6CE68 | 73…173 | The correct X axis of ip_toil_pl_mres__toil__fac_pvs_mdres_pl (see (c)) |
0x704CE–0x704D4 | dtc-code ×4 | u16 | fault-path record | all 0 | An unused fault path. Harmless |
0x70A32, 0x70DF0 | scalar | u16, u8 | 0x09229A, 0x09965C | Used together with c_mtcpwm_* (map-thermostat PWM) | |
0x70DF1, 0x70DF2 | scalar | u8 | 0x09D342…0x09D8BE | Anti-jerk (c_*_aj) | |
0x70B46, 0x70C5C, 0x70E0A | scalar | u8 | knock / cam / misfire code | Adjacent to c_cycnr_supp_st, c_sum_diagcps_max, c_maf_ftl_max | |
0x70002–0x7000D | scalar, pointer | 0x09DACE, 0x0E3354 | Ident and version bytes | ||
0x73135, 0x73335, 0x73FE2–0x73FFE | scalar, indexed | 0x0EEE28, 0x0EFFCC, 0x0E3354 | Calibration checksum and monitor block | ||
0x7F000–0x7F004 | scalar, pointer | init routine 0x0E3050 (next to the calibration-copy routine) | Its purpose is unknown | ||
0x781A8, 0x78304 | pointer-arg | 0BD7B0/0BD918 | Far pointers passed to a generic routine; extent unknown |
The table above lists the main items. data/coverage.json → uncovered has all 45.
(b) XDF items the code never references
| Item | File | Note |
|---|---|---|
c_dtc_sav_1, c_dtc_sav_3 | 0x70498, 0x704A4 | Probably reached through a fault-path record that does not have the consecutive-pointer pattern |
-----Softwareversion----- | 0x70042 | Ident string, so expected |
id_maf_tab__v_maf, …_1__v_maf_2, id_saf_tab__v_saf, id_saf_tab__v_saf_1__v_saf_2 | 0x70EC6, 0x710C6 | Reached through the near-to-far idiom at 0x0DE272/0x0DE516 (counted as a weak reference) |
id_fac_ti_rpl__cycnr | 0x7595C | 16 bytes. No reference found |
ldp_id_maf_tab_2, ldp_nr_pat__pat_fcut, ldp_v_saf_2 | 0x740B2, 0x74115, 0x74147 | Axes with no lookup that uses them. Possibly dead, or used only by the RAM-copy code paths |
Another 42 items are touched only by weak references (far-pointer tables or unresolved record-based lookups). Examples are id_knkwb_*, id_knkwe_*, ip_fac_knk_1..5, ip_maf_vo_2..8, ip_ti_cop_nr_* and ip_pvs_min_at_*_ef. They are used, but their size cannot be checked statically.
(c) Size and dimension disagreements
| XDF item | XDF says | Code says | Status |
|---|---|---|---|
ip_toil_pl_mres__toil__fac_pvs_mdres_pl (0x79048) | Row axis linked to ldp_toil__toil_pl_mres at 0x746FC | Descriptor at file 0x6CE68 gives X axis 0x749D1 (5 values: 73, 98, 123, 148, 173) | XDF wrong axis. Verified from the descriptor bytes |
ldp_toil__toil_pl_mres (0x746FC) | 5 values | Count byte at 0x746FB = 12. Used by the 0D0888 descriptor at 0x6CE44 (12 ascending values, 0x00…0xFF) | XDF too short. Verified |
c_t_dly_fuc_can_off, c_t_dly_fuc_can_on (0x70884, 0x70886) | u8 | Read as words (MOV) at 0x0C8C0C, 0x0C8C32 and 0x0C8C58 | XDF probably should be u16. Verified access width |
c_cycnr_ad_adc_knk, c_cycnr_ad_rtd_knk (0x7011C, 0x7011E) | u16 | Only the low byte is read (MOVB), at 0x0B5BB6, 0x0B6B5C and others | Either the XDF is too wide or the code uses only the low byte. Inferred |
The 32-bit constants (c_t_dly_*, element size 4) are read as two words, which agrees with the XDF. No map in the XDF has dimensions or an element size that differ from the code, and no map is transposed relative to the code's X-major layout. Both checks covered the 793 maps and curves whose dimensions were resolved (33 more have unknown dimensions).
430066 (brief)
The 430066 program shares the lookup library byte for byte and uses the same entry point. 148 KB of the program and 29.8 KB of the calibration differ from 430069. The same analysis on the 430066 dump finds 3,050 strong references, of which 1,801 have the same address, kind and size as in 430069.
| Calibration block | Same address in 430066 |
|---|---|
0x70000–0x70FFF / 0x71000–0x71FFF (scalars) | 94 % / 87 % |
0x7C000–0x7EFFF | 100 % |
0x74000–0x7BFFF (axes and maps) | Mostly shifted by small, varying amounts (−4, −14, −5 … bytes) |
| XDF applied to 430066 | Uncovered | Partial | Mismatches | Unreferenced |
|---|---|---|---|---|
| 430069 XDF | 138 | 487 | 254 | 61 |
| 430064 XDF | 269 | 393 | 196 | 196 |
The two versions belong to the same program family, but the calibration layout is not interchangeable. The 430069 XDF is not safe on 430066 for maps and axes. Its scalars mostly line up. The 430064 XDF fits 430066 even worse. A 430066 XDF should be generated from code_refs for that dump. Run tools/c166_analysis.py on it; the lookup catalogue applies unchanged.
Caveats
- Code discovery. 97.9 % of the non-0xFF program is decoded, but about 81 points of that come from heuristic entries (inferred). Code that is reached only through function pointers in RAM could still be missing, and so could the calibration items it uses.
- Dataflow. Register state is merged only across fully processed predecessors. Loops reset it, which is why 16 lookups stay unresolved.
- Table dimensions. For direct table reads, the dimensions come from the most recent axis search on the same path. A table whose axis search ran in another function would get no dimensions (26 maps and 7 curves).
- Patterns. The DTC fault-path records and the "function guess" column rest on patterns and on the XDF names of neighbouring items, so they are inferred.
- RAM copy. Only flash-resident reads are seen. Code that reads the calibration RAM copy at
0x50000was not found in stock 430069.
Reproducing
python3 -I tools/c166_analysis.py <430069.bin> --c166dis ../c166dis \
--out data/code_refs.json [--listing /tmp/430069.lst]
python3 -I tools/xdf_coverage.py --refs data/code_refs.json \
--xdf Siemens_MS43_430069_512K.xdf --bin <430069.bin> \
--label 430069 --out data/coverage.json
# cross-version: analyse 430066, then append each XDF comparison under cross_version
python3 -I tools/c166_analysis.py <430066.bin> --out /tmp/refs_430066.json
python3 -I tools/xdf_coverage.py --refs /tmp/refs_430066.json --xdf <xdf> \
--bin <430066.bin> --label 430066_vs_430069_512K --append-to data/coverage.json