diff --git a/.github/workflows/installer.yml b/.github/workflows/installer.yml index 251a518..6e40719 100644 --- a/.github/workflows/installer.yml +++ b/.github/workflows/installer.yml @@ -47,8 +47,8 @@ jobs: run: | VERSION=$(sed -n 's/^#define FMINI_VERSION "v\(.*\)"/\1/p' firmware/src/fmini_app.c) mkdir -p _site - python3 web/make_fmini_installer.py build/felucca.fwsc _site/index.html "$VERSION" - cp build/felucca.fwsc "_site/fmini-1-$VERSION.fwsc" + python3 web/make_fmini_installer.py "$(ls build/fmini-1-fm1-*.fwsc | head -1)" _site/index.html "$VERSION" + cp "$(ls build/fmini-1-fm1-*.fwsc | head -1)" "_site/fmini-1-$VERSION.fwsc" cp docs/fmini-ad.mp4 docs/fmini-ad-poster.jpg _site/ mkdir -p _site/editor && cp web/editor_fmini.html _site/editor/index.html # the patch editor (web/test_editor_fmini.py) cp -r docs/emu _site/emu # the browser emulator (web/emu/build_wasi.sh builds docs/emu) diff --git a/BUILDING.md b/BUILDING.md index 3eefc19..ba91fd4 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -4,9 +4,9 @@ The build makes three files in `build/`: | File | What | | --- | --- | -| `felucca.bin` | the firmware app | +| `fmini-1-fm1-.bin` | the firmware app | | `loader/ota.bin` | the update loader | -| `felucca.fwsc` | the installable package (app + loader) | +| `fmini-1-fm1-.fwsc` | the installable package (app + loader) | ## Get the source @@ -132,7 +132,7 @@ Use the web installer in Chrome or Edge: From the command line (needs `pip3 install mido python-rtmidi`): ``` -python3 tools/fm1_install.py build/felucca.fwsc +python3 tools/fm1_install.py build/fmini-1-fm1-.fwsc python3 tools/fm1_install.py --info # identity of the connected FM-1 ``` @@ -140,8 +140,8 @@ Or, to install your own build from the web installer, make a local copy of the s (Web MIDI needs a secure context): ``` -python3 web/make_site.py build/felucca.fwsc dev /tmp/felucca-site -cd /tmp/felucca-site && python3 -m http.server 8000 +python3 web/make_site.py build/fmini-1-fm1-.fwsc dev /tmp/fmini-1-fm1-site +cd /tmp/fmini-1-fm1-site && python3 -m http.server 8000 # open http://localhost:8000/webapp/installer/ ``` diff --git a/CLAUDE.md b/CLAUDE.md index cc314e6..ebe43d3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -24,13 +24,13 @@ toolchain setup. ``` export JIELI_TOOLCHAIN= AC79_SDK= -./build.sh # build/felucca.bin, build/loader/ota.bin, build/felucca.fwsc (~30 s) +./build.sh # build/fmini-1-fm1-.bin, build/loader/ota.bin, build/fmini-1-fm1-.fwsc (~30 s) sh tests/run_tests.sh > /tmp/tests.log 2>&1 # the whole host suite, 20-30 minutes; run it in the background python3 tools/fmini_filter.py # regenerate firmware/src/eng_fmini_filter.h (filter laws and tables) python3 tools/gen_fmini_presets.py # regenerate firmware/src/eng_fmini_presets.h from tools/fmini_bank.py python3 tools/preset_lab.py --wasm docs/emu/felucca.wasm --out DIR # render and measure the 100 factory patches WASI_SDK= sh web/emu/build_wasi.sh # docs/emu (the browser emulator) -python3 web/make_fmini_installer.py build/felucca.fwsc docs/index.html X.Y.Z # the installer page (docs/index.html) +python3 web/make_fmini_installer.py build/fmini-1-fm1-.fwsc docs/index.html X.Y.Z # the installer page (docs/index.html) ``` A single host test is one `cc` line (they are in `tests/run_tests.sh`); `tests/fmini_filter_test.c` and `tests/fmini_app_test.c` diff --git a/tests/install_test.py b/tests/install_test.py index 2ab1f35..4bcfa25 100755 --- a/tests/install_test.py +++ b/tests/install_test.py @@ -6,7 +6,7 @@ The fake device is the one in web/test_web.mjs: identity on the handshake, then "device asks, host answers" reads of the logical image. Run from the repo root: python3 tests/install_test.py Also checks logical_image/product_of against web/fm1pkg.js (needs node and -build/felucca.fwsc, skipped otherwise).""" +build/fmini-1-fm1-.fwsc, skipped otherwise).""" import io import queue import shutil @@ -210,14 +210,6 @@ def installs(): rc, out, err = cli(["--info"], dev) ok(rc == 0 and "FM-1_905" in out and not any(c in out for c in "\x1b\x07"), "--info: control bytes in the device's identity are not printed") - import fm1_sample_upload as U - lines = U.slot_info([3, 80, 2, 0x41, 0x1B, 0x5B, 0x32, 0x4A, 0, 40, 0, 0, 0, 0, 0, 0]) - ok(lines[0] == "USR1: 2 zones, A?[2J, 40 KiB" and lines[1] == "USR2: empty", "sample upload: slot names printable only") - try: - U.slot_info([3, 80, 2, 0x41]) - ok(False, "sample upload: a malformed SMP_INFO reply is an error") - except ValueError: - ok(True, "sample upload: a malformed SMP_INFO reply is an error") def errors(): @@ -274,9 +266,9 @@ def errors(): def against_js(): - clean = ROOT / "build/felucca.fwsc" + clean = next(iter(sorted((ROOT / "build").glob("fmini-1-fm1-*.fwsc"))), ROOT / "build/none.fwsc") if not shutil.which("node") or not clean.exists(): - print("logical image vs fm1pkg.js: skipped (needs node and build/felucca.fwsc)") + print("logical image vs fm1pkg.js: skipped (needs node and build/fmini-1-fm1-*.fwsc)") return js = ("import { logicalImage, productOf } from %r; import { readFileSync } from 'node:fs';" "const p = readFileSync(process.argv[1]); process.stderr.write(productOf(p));" diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 58736eb..a90dd2f 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -234,15 +234,17 @@ EOF "$OUT/usb_desc_test" done -[ -f build/felucca.fwsc ] || { echo "run ./build.sh first"; exit 1; } +PKG=$(ls build/fmini-1-fm1-*.fwsc 2>/dev/null | head -1) +APP=$(ls build/fmini-1-fm1-*.bin 2>/dev/null | grep -v -- -app.bin | head -1) +[ -f "$PKG" ] || { echo "run ./build.sh first"; exit 1; } $CC -DOWN_PKG=1 -o "$OUT/ota_test" tests/ota_test.c -run "M-UPGRADE entry (own loader)" "$OUT/ota_test" build/felucca.fwsc +run "M-UPGRADE entry (own loader)" "$OUT/ota_test" "$PKG" -head -c 200000 build/felucca.bin > "$OUT/old_app.bin" +head -c 200000 "$APP" > "$OUT/old_app.bin" python3 tools/fm1pkg_make.py "$OUT/old_app.bin" build/loader/ota.bin "$OUT/old.fwsc" >/dev/null $CC -o "$OUT/ldr_test" tests/ldr_test.c -run "update loader: other app -> this build" "$OUT/ldr_test" "$OUT/old.fwsc" build/felucca.fwsc +run "update loader: other app -> this build" "$OUT/ldr_test" "$OUT/old.fwsc" "$PKG" if [ -f build/gen/felucca_tables.h ]; then $CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/hostsim" tests/hostsim.c -lm @@ -451,9 +453,9 @@ else SCC="${CC%% *} $SAN -Ibuild/gen -Ifirmware/src" export ASAN_OPTIONS="${ASAN_OPTIONS:-detect_leaks=0}" $SCC -o "$A/ldr_test" tests/ldr_test.c - run "ASan/UBSan: update loader (other app -> this build)" "$A/ldr_test" "$OUT/old.fwsc" build/felucca.fwsc + run "ASan/UBSan: update loader (other app -> this build)" "$A/ldr_test" "$OUT/old.fwsc" "$PKG" $SCC -DOWN_PKG=1 -o "$A/ota_test" tests/ota_test.c - run "ASan/UBSan: M-UPGRADE entry (own loader)" "$A/ota_test" build/felucca.fwsc + run "ASan/UBSan: M-UPGRADE entry (own loader)" "$A/ota_test" "$PKG" for t in editor_test project_test backup_test robust_test fun10_test fm6bank_test; do $SCC -o "$A/$t" tests/$t.c -lm run "ASan/UBSan: $t" "$A/$t" diff --git a/tools/build.py b/tools/build.py index 7c1d7bc..d5cd8e3 100755 --- a/tools/build.py +++ b/tools/build.py @@ -51,6 +51,7 @@ SDK_SHA256 = { PRODUCT = "FM-1_900" # package identity; release builds are FM-1_9XY VERSION = None # FELUCCA_VERSION for release builds (default: firmware/src/felucca.c) +STEM = "fmini-1-fm1" # output stem: fmini-1-fm1- (set by main) # FELUCCA_CPU2 (firmware/src/felucca.c), unset or 1, the default (1.6.1): the second core is built in, its entry and # stacks (firmware/hal/fm1_cpu1.S) linked and its waiting loop (.c1_text) checked; MENU > SYSTEM > 2ND CORE starts it # (OFF by default: one core, as 1.6). FELUCCA_CPU2=0: none of it is built (1.6's one-core code and RAM) @@ -251,7 +252,7 @@ def build_app(): img += b"\xff" * (load - APP_XIP - len(img)) img += blob img += b"\xff" * (-len(img) % 4) - (OUT / "felucca.bin").write_bytes(img) + (OUT / f"{STEM}.bin").write_bytes(img) return bytes(img), syms, dis, rt @@ -376,14 +377,17 @@ def main(): ap.add_argument("--release", metavar="X.Y", help="release build: identity FM-1_9XY, version string vX.Y") ap.add_argument("--sdk", type=Path, help="JieLi AC79 SDK checkout (default: $AC79_SDK)") a = ap.parse_args() - name = "felucca.fwsc" + global STEM + m0 = re.search(r'#define FMINI_VERSION "v(\d+\.\d+\.\d+)"', (FW / "src" / "fmini_app.c").read_text()) + STEM = "fmini-1-fm1-" + (m0[1] if m0 else "dev") # the FMini-1-fm1 package: fmini-1-fm1-.fwsc if a.release: # one digit each: the identity has room for two (X.Y.Z and X.Y.Z.W keep X.Y's) m = re.fullmatch(r"(\d)\.(\d)(?:\.\d){0,2}(-[A-Za-z0-9]+)?", a.release) if not m: raise SystemExit(f"--release {a.release}: use X.Y, X.Y.Z, X.Y.Z.W or X.Y-suffix, one digit each") PRODUCT = "FM-1_9" + m[1] + m[2] VERSION = "v" + a.release.lower() # e.g. v1.0, v1.1-rc1 - name = f"felucca-{a.release}.fwsc" + STEM = f"fmini-1-fm1-{a.release}" + name = STEM + ".fwsc" if not (FW / "engines" / "src" / "felucca_engine.h").exists(): raise SystemExit("firmware/engines is empty: the Felucca-Engines submodule " "(git submodule update --init, or clone with --recurse-submodules)") @@ -410,14 +414,14 @@ def main(): raise SystemExit("build: checks failed") pkg = fm1pkg_make.ufw(fm1pkg_make.flash_image(img, fm1pkg_make.KEY), ota, PRODUCT) (OUT / name).write_bytes(pkg) - print(f"app {OUT / 'felucca.bin'} {len(img)} B") + print(f"app {OUT / (STEM + '.bin')} {len(img)} B") print(f"loader {LDR / 'ota.bin'} {len(ota)} B") print(f"package {OUT / name} {len(pkg)} B, identity {PRODUCT}") if a.release: # what a release carries: the package, the app and every licence they need rel = OUT / f"release-{a.release}" shutil.rmtree(rel, ignore_errors=True) (rel / "LICENSES").mkdir(parents=True) - app = f"felucca-{a.release}-app.bin" + app = f"{STEM}-app.bin" (rel / name).write_bytes(pkg) (rel / app).write_bytes(img) (rel / "SHA256SUMS").write_text("".join(f"{hashlib.sha256(b).hexdigest()} {n}\n" diff --git a/web/make_fmini_installer.py b/web/make_fmini_installer.py index ab89c41..08fad50 100644 --- a/web/make_fmini_installer.py +++ b/web/make_fmini_installer.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-3.0-only # FMini-1: the official site, one self-contained page (site_fmini.html: the Minimoog-styled site with the screens, the presets, # MIDI and the Felucca installer's logic; the firmware package and every picture are embedded). -# web/make_fmini_installer.py build/felucca.fwsc OUT.html [VERSION] +# web/make_fmini_installer.py build/fmini-1-fm1-.fwsc OUT.html [VERSION] # Serve it over https or http://localhost (Web MIDI with SysEx needs a secure context), in Chrome / Edge. import base64 import json diff --git a/web/test_web.mjs b/web/test_web.mjs index 2bd12c4..de1ea1d 100644 --- a/web/test_web.mjs +++ b/web/test_web.mjs @@ -11,7 +11,7 @@ // - fm1ota.js: a full install and an unplug during the write against a simulated FM-1 import { execFileSync } from "node:child_process"; -import { existsSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs"; +import { existsSync, mkdtempSync, readdirSync, readFileSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import vm from "node:vm"; @@ -1622,7 +1622,7 @@ function samplesMatch() { /* ------------------------------------------------------- packages: JS == Python --- */ async function packages() { - const pkg = join(FW_ROOT, "build/felucca.fwsc"); + const pkg = readdirSync(join(FW_ROOT, "build")).filter(f => /^fmini-1-fm1-.*\.fwsc$/.test(f)).map(f => join(FW_ROOT, "build", f))[0]; if (!existsSync(pkg)) { console.log("packages: skipped (run ./build.sh first)"); return;