mirror of
https://github.com/illuminus5/skiff.git
synced 2026-12-06 12:54:32 +01:00
- Skiff on M-VAVE's SMK-37 Pro keyboard (BOARD=smk37): velocity keys, the pads as a step grid, the faders as a mixer, wheels and pedal as MIDI in, MIDI OUT with clock; Elite and MKE-P37 packages built the same way, not tried on a keyboard. Install, backup and the way back in SMK37.md. The board layer is genkigenki's SMK-37 port of Felucca. - SONG: REST, a pickable entry, so a track starts later or ends sooner (#28); the last track moves on too when an edited pattern is waiting to be written (#29). - THEME > CUSTOM: eleven colours and a look from the web editor; MENU > DISPLAY > PLAYHEAD LINE (#27). - Each user sample's own LEVEL, REVERB and DELAY: EDIT > SAMPLES on the unit, the editor's Samples tab, fm1_sample_upload.py mix (#21). - The installers resume a write cut short, move their bar forward only and keep each package on its own model's unit; the update loaders write the app's first sector last on both boards.
62 lines
3.1 KiB
Python
62 lines
3.1 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
# SMK-37 Pro port: Copyright (C) 2026 M. Geisler (genkigenki/makkuro)
|
|
"""An SMK-37 Pro package from fm1pkg_make.py --board smk37: flash.bin is the stock PRCT size (0x9D000) and
|
|
its app area carries the stock v016 region table exactly, so the SDK
|
|
and a later stock rollback see the same VM / BTIF / USRTRIM / USRFLASH / USR regions.
|
|
smk_pkg_test.py PACKAGE.fwsc [PRODUCT]"""
|
|
import struct
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT / "tools"))
|
|
import fm1_install as I # noqa: E402
|
|
import fm1pkg_make as M # noqa: E402
|
|
|
|
failed = 0
|
|
|
|
|
|
def ok(cond, what):
|
|
global failed
|
|
print(f"smk pkg: {what:<70} {'ok' if cond else 'FAIL'}")
|
|
failed += not cond
|
|
|
|
|
|
raw = Path(sys.argv[1]).read_bytes()
|
|
want_product = sys.argv[2] if len(sys.argv) > 2 else "SMK-37 Pro_900"
|
|
image, n = I.deinterleave(raw), I.block_count(raw)
|
|
ok(n == 20 and I.product_of(raw) == want_product and I.files_ok(image),
|
|
f"identity {I.product_of(raw)}, 20 blocks, CRCs ok")
|
|
hdr = I._dec(image[:0x40])
|
|
e0 = I._dec(image[0x40:0x90])
|
|
off, size = struct.unpack_from("<II", e0, 8)
|
|
ok(struct.unpack_from("<H", e0, 0)[0] == 0 and size == 0x9D000, f"flash.bin {size:#x} B (stock PRCT 0x9D000)")
|
|
flash = bytearray(image[off:off + size])
|
|
area = bytearray(flash[0x4000:0x4000 + 0x400])
|
|
M.sfc(area, 0, len(area), 0, M.KEY)
|
|
ents = []
|
|
for k in range(1, 12):
|
|
e = bytes(area[k * 32:(k + 1) * 32])
|
|
if M.crc16(e[2:]) != struct.unpack_from("<H", e)[0]:
|
|
break
|
|
dcrc, eoff, esize, flags, resvd, index = struct.unpack_from("<HIIBBH", e, 2)
|
|
ents.append((eoff, esize, flags, resvd, index, e[16:32]))
|
|
want = [(0x9D000, 0x23000, 0x12, 0x81, 0, bytes.fromhex("564d00ffffffffffffffffff00800000")),
|
|
(0, 0x9D000, 0x92, 0x82, 0, bytes.fromhex("5052435400ffffffffffffff434f4445")),
|
|
(0xC0000, 0x1000, 0x92, 0x82, 0, bytes.fromhex("4254494600ffffffffffffff4155544f")),
|
|
(0xC1000, 0x1000, 0x92, 0x81, 0, bytes.fromhex("5553525452494d00ffffffffffffffff")),
|
|
(0xC2000, 0x29000, 0x92, 0x81, 0, bytes.fromhex("555352464c41534800ffffffffffffff")),
|
|
(0xF4000, 0xA000, 0x92, 0x81, 1, b"USR\0" + b"\xff" * 12)]
|
|
ok([e[5][:7] for e in ents[:2]] == [b"app.bin", b"cfg_too"], "app.bin, cfg_tool.bin first")
|
|
ok(ents[2:] == want, "region table == stock v016 (VM, PRCT, BTIF, USRTRIM, USRFLASH, USR)")
|
|
ok(flash[:0x4000] != b"\xff" * 0x4000, "head present (never written by the loader, checked against the device)")
|
|
if len(sys.argv) > 2: # a BOARD=smk37 build's package: its loader fits what the stock app stages (build.py)
|
|
ldr = [struct.unpack_from("<I", I._dec(image[0x40 + k * 0x50:0x90 + k * 0x50]), 12)[0]
|
|
for k in range(struct.unpack_from("<H", hdr, 8)[0])
|
|
if struct.unpack_from("<H", I._dec(image[0x40 + k * 0x50:0x90 + k * 0x50]), 0)[0] == 100]
|
|
ok(len(ldr) == 1 and ldr[0] <= 0xBEF00 - 0xBD000,
|
|
f"loader {ldr[0] if ldr else 0} B, within the stock app's staging (7936 B)")
|
|
print("SMK PACKAGE TEST FAILED" if failed else "smk package test passed")
|
|
sys.exit(1 if failed else 0)
|