Files
illuminus5 32828c4aa5 Skiff 2.0: NOTES and FEEL, chains, sounds on song entries, drum lanes panned, your own drum kits
- The step pages, four become two: NOTES (the piano roll, a selection edited as one, notes that overlap with lengths
  of their own, copy, paste and delete) and FEEL (chance and conditions, ratchets, nudge, accent and slide).
- SONG: chains (entries on CHAIN played and edited as one long pattern), NEW, COPY+, copies numbered beside their
  originals, SONG ONCE, the pool's EMPTY and UNUSED, and a sound on any entry, loaded as the track comes onto it.
- DRUM and DRUM-X: LANE MIX, each lane's level and pan. DRUM's KIT on to USR1-3: a sample slot as the kit, built in
  the web editor's Samples tab, a WAV a lane.
- One mute in the GLO, FX and PERFORM layers, one RETURN, one MOD page, DIST through INSERT's shapers.
- A user sound stays the track's over a save, a load and power-on; RESTORE LAST writes 2 s after the last change.
- New save formats (projects, settings, user presets, parameters by stored id) with a converter in the installer and
  the editor's Restore (Felucca 1.2+ projects and presets too); about 30 KB freed on the FM-1; release builds without
  the serial console.
- The SMK-37 Pro: the sustain pedal holds the keys; its loaders start the flash at the app's speed.
- Fixes: REC on an armed track disarms every track, RANDOM on a lengthened line, PD BRASS's clicks (#41), settings
  from Felucca 1.4+ or JIANT.
2026-10-24 18:56:17 -05:00

83 lines
3.3 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-only
"""(Skiff 2.0) What a change costs in flash and RAM: two builds' ELFs compared, section by section, symbol by symbol
and source file by source file, the biggest changes first. Build the base commit in a mirror of its own (git archive),
never in another session's build dir.
size_diff.py OLD.elf NEW.elf [N] (N: the rows of each list, default 30; needs binutils' nm and readelf)
The image is what the app slot holds: .text + .ram_text + .data. Symbols named .GJTIE* lie inside other functions
(their jump tables): left out, as are unsized labels."""
import subprocess
import sys
from collections import Counter
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
import size_fns # noqa: E402
SECTIONS = (".text", ".ram_text", ".data", ".bss", ".pool", ".noinit", ".ramx")
IMAGE = (".text", ".ram_text", ".data")
def run(*cmd):
return subprocess.run(cmd, capture_output=True, text=True, check=True).stdout
def load(elf):
"""{section: size}, {symbol: (section, size)}"""
sec, bounds = {}, []
for line in run("readelf", "-S", "-W", elf).splitlines():
p = line.replace("[ ", "[").split()
if len(p) > 5 and p[1] in SECTIONS:
a, n = int(p[3], 16), int(p[5], 16)
sec[p[1]] = n
bounds.append((a, a + n, p[1]))
syms = {}
for line in run("nm", "-S", "--defined-only", elf).splitlines():
p = line.split()
if len(p) != 4 or p[3].startswith("."):
continue
a, n = int(p[0], 16), int(p[1], 16)
s = next((b[2] for b in bounds if b[0] <= a < b[1]), None)
if s:
syms[p[3]] = (s, syms.get(p[3], (s, 0))[1] + n) # (a name static in two places: summed)
return sec, syms
def file_of():
"""symbol -> the source file defining it (size_fns' definitions: the unity build's symbols carry no file)"""
m = {}
for f in sorted(size_fns.SRC.glob("*.c")):
for n in size_fns.definitions(f.read_text(errors="replace")):
m.setdefault(n, f.name)
return m
def main(old, new, n=30):
(s0, y0), (s1, y1) = load(old), load(new)
print(f"{'section':<10} {'old':>9} {'new':>9} {'delta':>8}")
for s in SECTIONS:
if s in s0 or s in s1:
print(f"{s:<10} {s0.get(s, 0):9d} {s1.get(s, 0):9d} {s1.get(s, 0) - s0.get(s, 0):+8d}")
i0, i1 = sum(s0.get(s, 0) for s in IMAGE), sum(s1.get(s, 0) for s in IMAGE)
print(f"{'image':<10} {i0:9d} {i1:9d} {i1 - i0:+8d} (.text + .ram_text + .data)\n")
d = {k: y1.get(k, ("", 0))[1] - y0.get(k, ("", 0))[1] for k in set(y0) | set(y1)}
d = {k: v for k, v in d.items() if v}
print(f"symbols changed: {len(d)}")
for k in sorted(d, key=lambda k: (-abs(d[k]), k))[:n]:
sec = (y1.get(k) or y0.get(k))[0]
print(f" {d[k]:+7d} {k} ({sec}{', new' if k not in y0 else ', gone' if k not in y1 else ''})")
fm, per = file_of(), Counter()
for k, v in d.items():
per[fm.get(k.split(".")[0], "?")] += v
print("\nper source file (inlined code counts where it lands):")
for f, v in sorted(per.items(), key=lambda x: -abs(x[1]))[:n]:
if v:
print(f" {v:+7d} {f}")
return 0
if __name__ == "__main__":
if len(sys.argv) < 3:
sys.exit(__doc__)
sys.exit(main(sys.argv[1], sys.argv[2], *(int(a) for a in sys.argv[3:4])))