Files
BFM-decomp/diff_settings.py
T
Drew T 144839f24b feat(phase-13): T1a/T1b — SC01/077 onboarded + all-asm byte-match (d19c9580)
- ov_SC01_077 scaffolded: config/overlays.mk (OVERLAY_BINARIES + var block),
  config/splat.ov_SC01_077.yaml (from template), check.sha, empty symbols, +
  ov_SC01_077 entry & sentinel anchor in the 4 Python BINARIES dicts
- GATE T1b: make check BINARY=ov_SC01_077 -> d19c9580 BYTE-IDENTICAL @ 100%
  INCLUDE_ASM; clean rebuild leaves main 143dbb89 + resident 8e17e02f unregressed
- reusable non-word-aligned-overlay handling (~75% of fleet) added to the
  template + Makefile: (1) [word_floor, bin, trailing] carve for the final 1-3
  bytes spimdisasm drops; (2) build/assets/%.o incbin rule (+ .data align=1) for
  splat bin assets (asset_path scoped per-alias); (3) objcopy end-align TRIM
  (shrink-only, <=3 B) removing the .ld's segment-end ALIGN(.,4) pad
- .gitignore /assets/ (regenerable splat output); clean removes assets/
2026-06-16 15:39:52 -06:00

45 lines
2.6 KiB
Python

# asm-differ project config — BFM-decomp (SLUS_007.26, USA, PSX little-endian R3000).
#
# The matching oracle: diff one function's codegen in our build against the
# byte-identical `expected/` baseline. Object mode (-o) is the default workflow:
# .venv/bin/python tools/asm-differ/diff.py -mo <function> # -m rebuild, -o vs object
# Score 0 = matched (instruction-identical incl. regalloc); anything else = not matched.
#
# `expected/` is a snapshot of a SHA1-GREEN build (= the original bytes, since the
# all-INCLUDE_ASM build is byte-identical). Re-snapshot it ONLY after a green build
# (`make expected`) — a stale baseline causes phantom matches/regressions (SETUP.md §6.4).
import os
# Per-binary asm-differ images (Phase 9). asm-differ calls apply(config, args) with a fixed
# signature we don't control, so the active binary is selected via the BFM_BINARY env var
# (default main = the retail EXE; a Gen2 binary adds an entry + sets BFM_BINARY=<alias>).
BINARIES = {
"main": dict(baseimg="expected/build/us/SLUS_007.26.elf",
myimg="build/us/SLUS_007.26.elf",
mapfile="build/us/SLUS_007.26.map"),
"resident": dict(baseimg="expected/build/resident/resident.elf",
myimg="build/resident/resident.elf",
mapfile="build/resident/resident.map"),
"ov_SC01_077": dict(baseimg="expected/build/ov_SC01_077/ov_SC01_077.elf",
myimg="build/ov_SC01_077/ov_SC01_077.elf",
mapfile="build/ov_SC01_077/ov_SC01_077.map"),
# <<< overlays: tools/new_overlay.sh inserts ov_* entries above this line (Phase 13) >>>
}
def apply(config, args):
_bin = os.environ.get("BFM_BINARY", "main")
if _bin not in BINARIES:
raise SystemExit(f"diff_settings: unknown BFM_BINARY={_bin!r} (known: {', '.join(BINARIES)})")
_cfg = BINARIES[_bin]
config["arch"] = "mipsel" # little-endian MIPS, R3000 (PSX CPU)
config["baseimg"] = _cfg["baseimg"] # image-mode target (byte-identical baseline)
config["myimg"] = _cfg["myimg"] # image-mode current build
config["mapfile"] = _cfg["mapfile"] # GNU ld -Map: symbol -> object + address
config["map_format"] = "gnu"
config["expected_dir"] = "expected/" # -o: expected path = expected_dir + objpath
config["build_dir"] = "build/" # (objpath "build/src/800.o" -> expected/build/src/800.o)
config["source_directories"] = ["src", "asm", "include"]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
config["makeflags"] = []