The SMK-37 target from github.com/genkigenki/Felucca branch smk37 (commit b67312c on Felucca 1.6.1, = hugelton/Felucca#237; the fm1-to-smk37 kit's Felucca layer), applied to FMini-1, whose firmware/hal and firmware/loader are Felucca 1.6.1's: - BOARD=smk37 / MODEL=pro|elite|mke (tools/build.py, build.sh), the SMK flash map with its protected ranges (fm1_flash_map.h), the update path and its size checks (ota.c, ldr_core.c), the SMK input HAL, LCD and pad LEDs, the owner tag of the store, installers and tests. - Conflicts resolved for FMini-1: packages fmini-1-fm1-<version>.fwsc and fmini-1-smk37[-elite|-mke]-<version>.fwsc; FL_JEDEC_OK keeps the UC25HQ80 (0xB36014) on the FM-1 and accepts it on the SMK too; the official V16 length stays FM-1 only; the sample slots stay gone (FMini-1 has no SAMPLE engine: the layer's eng_sample.c and editor sample hunks are not taken); main.c keeps FMini-1's UI_* hooks with the SMK calls around them. - The FM-1 build is byte-identical to 2.5.0 (app, package and loader hashes). The SMK build does not link yet: FMini-1's preset objects need places in the SMK store, and fmini_app.c's LED code is FM-1 sized. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUF6pQ1NkTwmBC8SR8AK94
7.9 KiB
Building Felucca
The build makes three files in build/:
| File | What |
|---|---|
fmini-1-fm1-<version>.bin |
the firmware app |
loader/ota.bin |
the update loader |
fmini-1-fm1-<version>.fwsc |
the installable package (app + loader) |
Get the source
Five engines are in a git submodule (firmware/engines/, Felucca-Engines,
MIT), so clone with --recurse-submodules:
git clone --recurse-submodules https://github.com/hugelton/Felucca.git
In a clone made without it, run git submodule update --init once. GitHub's "Download ZIP" and the source archives
it adds to a release leave firmware/engines/ empty; each release also has felucca-X.Y.Z-source.tar.gz, the whole
source with the submodule's files in it. The build stops with "firmware/engines is empty" when they are missing.
Prerequisites (macOS)
-
Python 3 with Pillow and fontTools:
pip3 install Pillow fonttools(the UI font and icons are rasterised at build time) -
Docker Desktop. The JieLi toolchain is Linux x86-64 only; the build runs each tool in a
linux/amd64debian:bookworm-slimcontainer (Rosetta on Apple silicon). Keep the source tree in a folder Docker can share, e.g. under/Users. -
The JieLi Linux toolchain (clang 4.0.1 for pi32v2, from JieLi's package server):
tools/get_toolchain.sh # installs to ~/.jieli/toolchain -
The JieLi AC79 SDK (Apache-2.0). The package uses three of its files (
cpu/wl82/tools/uboot.boot,cfg_tool.bin,cfg/eq_cfg_hw.bin); they are not part of this tree.git clone --depth 1 --branch AC79NN_SDK_V1.2.1_2023-12-13 \ https://gitee.com/Jieli-Tech/fw-AC79_AIoT_SDK.git ~/fw-AC79_AIoT_SDK -
Node.js (optional, for the web tests).
-
Emscripten (optional,
emcc: the browser emulator,web/emu/).
On Linux x86-64 the toolchain runs natively and Docker is not needed.
Build
./build.sh
JIELI_TOOLCHAIN and AC79_SDK override the default locations
(~/.jieli/toolchain, ~/fw-AC79_AIoT_SDK).
./build.sh --release 1.0 makes a release build: the package identity becomes FM-1_910
and the version string v1.0; the package is build/felucca-1.0.fwsc, and
build/release-1.0/ holds what a release ships: the package, the app
(felucca-1.0-app.bin), SHA256SUMS, the sample attribution, LICENSE, LICENSING.md and
LICENSES/ (the package contains Apache-2.0 SDK files, so the licence texts travel with it).
Build options (environment, 0 or 1; defaults in firmware/src/felucca.c, core.h and icons.c):
| Flag | Default | |
|---|---|---|
FELUCCA_FLASH |
1 | settings, presets and projects in flash |
FELUCCA_OTA |
1 | update entry (needs FELUCCA_FLASH) |
FELUCCA_CDC |
1 | USB serial console |
FELUCCA_CDC_DEFAULT |
1 | 0: the console is built in but left out of USB from boot (as MENU > USB SERIAL OFF) |
FELUCCA_UAC |
1 | USB audio input (the master output, stereo, 44.1 or 48 kHz) |
FELUCCA_UAC_48K |
1 | 0: the USB audio input at 44.1 kHz only, as up to 1.0.5.2 (firmware/src/usb.c) |
FELUCCA_UAC_AS_FIRST |
1 | the audio control header lists the audio streaming interface before the MIDI one, so the USB audio driver of older macOS (up to 15) finds it; 0: 1.0 to 1.5's order, byte for byte (firmware/src/usb.c) |
FELUCCA_CPU2 |
1 | the second core is built in (MENU > SYSTEM > 2ND CORE, OFF by default); 0: none of it, 1.6's one-core code and RAM (firmware/hal/fm1_cpu1.h, firmware/src/fx.c) |
FELUCCA_UART |
1 (SMK-37 Pro: 0) | TRS MIDI IN; must stay 0 on the SMK-37 Pro (PH8 is a key row there) |
FELUCCA_SLICE |
1 | the SLICE engine |
FELUCCA_ICONS |
1 | parameter icons on the knob cards |
FELUCCA_FM4 |
0 | the retired DIGITAL engine (4-operator FM) instead of its FM6 conversion |
FELUCCA_USB_LAYOUT (0 to 3, default 0) picks other USB descriptor layouts for testing; see
firmware/src/usb.c.
Target board: BOARD=smk37 ./build.sh (or ./build.sh --board smk37) builds FMini-1 for the
M-Vave SMK-37 (beta): -DBOARD_SMK37=1 for the app and the update loader, identity SMK-37 Pro_900 (release
SMK-37 Pro_9XY), the SMK flash layout (PRCT 0x9D000, the stock region table with USRTRIM / USRFLASH) and the
package build/fmini-1-smk37-<version>.fwsc. MODEL=elite or MODEL=mke builds the same firmware under the SMK-37
Elite's or the MKE-P37's model name (build/fmini-1-smk37-elite-<version>.fwsc, build/fmini-1-smk37-mke-<version>.fwsc),
so the stock updater still takes that unit's factory package. Controls: SMK37.md. The intermediate files
(build/loader/ota.bin, build/felucca.dis, build/gen) are shared: build the FM-1 again before tests/run_tests.sh.
The default stays the FM-1, byte for byte.
Browser emulator
./build.sh
web/emu/build.sh
python3 -m http.server -d build/emu 8790 # open http://localhost:8790/
web/emu/felucca_web.c builds the firmware's sources as the host tests do, against a simulated FM-1, and
Emscripten compiles it to WebAssembly (build/emu/felucca.wasm, with index.html, worklet.js and the font in fonts/). The page
keeps the flash's storage sectors (projects, user presets, settings) in the browser. Not emulated: USB (audio,
MIDI out, the editor, updates), TRS MIDI and the user sample slots. A build of it is on the site:
https://hugelton.github.io/Felucca/webapp/try/.
FMini-1's browser build (docs/emu/, linked from the site; firmware = FELUCCA_FMINI_ONLY) needs no Emscripten:
WASI_SDK=/path/to/wasi-sdk web/emu/build_wasi.sh compiles the same felucca_web.c with wasi-sdk
(web/emu/wasi_shim/ stubs the few POSIX headers) into an import-free reactor module.
Tests
tests/run_tests.sh
Runs the host tests and, with Node.js, the web page tests (and, with Emscripten too, the browser emulator's). Run it after ./build.sh
(it uses build/ and needs AC79_SDK set as for the build). The suites cover flash storage,
user presets, projects of every format, backup, the keys and knobs, MIDI (USB, TRS, clock,
control), USB audio, the update entry and loader, the command-line installer, the UI (the real
drawing code against stubs: every screen in every palette is rendered and checked for clipped or
overlapping text; PNGs land in build/ui_new/), every engine (DRUM, NOISE, PHYS, FM6, SLICE, the
DIGITAL conversion), the chord keys, the modulation matrix, the FX layer, the reverbs, the SLICER
and swing. With DAISYSP pointing at a DaisySP checkout, the PHYS models are also compared with
their floating-point originals; without it that test is skipped. Felucca-Engines' own test
(firmware/engines/tests/run.sh) runs too, and its standalone host is built once more with Felucca's tables
against the same golden renders.
The regression suite (tests/regress.c) renders every engine and preset and compares a
hash of each render with tests/golden.txt; it also checks levels, voices and the CPU
cost (tests/cpu_baseline.txt, tests/target_budget.txt). After an intended change of
the sound, GOLDEN_UPDATE=1 sh tests/run_tests.sh rewrites the hashes; BUDGET_UPDATE=1
does the same for the cost files.
Install
Use the web installer in Chrome or Edge: https://hugelton.github.io/Felucca/webapp/installer/. It installs the released package.
From the command line (needs pip3 install mido python-rtmidi):
python3 tools/fm1_install.py build/fmini-1-fm1-<version>.fwsc
python3 tools/fm1_install.py --info # identity of the connected FM-1
Or, to install your own build from the web installer, make a local copy of the site and open it from localhost
(Web MIDI needs a secure context):
python3 web/make_site.py build/fmini-1-fm1-<version>.fwsc dev /tmp/fmini-1-fm1-site
cd /tmp/fmini-1-fm1-site && python3 -m http.server 8000
# open http://localhost:8000/webapp/installer/
Installing firmware is at your own risk. If an install fails and the FM-1 no longer starts, recovery needs FM-1-transporter.