Overview
FM1Kit speaks the FM-1's update protocol. It reads .fwsc firmware packages, finds the device, answers its read requests while it stages and writes the new firmware, and checks the device reports the new firmware afterwards. It can also finish an update that was cut off, or one started from USB recovery mode, and back up M-VAVE's open firmware before switching away from it.
Before a firmware is installed, it can read the package to work out how to switch away from it again later, and which way back to V15, V16, open firmware or m-bootloader that firmware allows.
From V15, it can install m-bootloader, which adds a recovery menu and the chip's USB download mode. A second library, FM1Rescue, uses download mode from a Mac to back up, restore and write the FM-1's whole flash, whatever firmware is installed. For an FM-1 that no firmware starts on, FM1Rescue also works through the FM-1 Transporter.
For firmware developers, PackageCheck reports on a package before it's released, and fm1probe can compare two packages or backups and run a simulated FM-1 that other updaters can talk to.
It sticks to the device: finding and downloading firmwares is left to your app. FM-SWITCH is built on it.
ImportantFM1Kit has been tested on one FM-1 so far, from both a Mac and an iPhone, and download mode, the FM-1 Transporter and firmware resources from a Mac. It knows the newer flash chip in FM-1s sold since autumn 2026, but hasn't yet been tried on one. It isn't affiliated with M-VAVE, and installing custom firmware is at your own risk.
Install the package
Add FM1Kit with Swift Package Manager. Until 1.0, minor versions may change the API, so take 0.8.x fixes but not 0.9.0. In 0.8.0, CoreMIDITransport.init(clientName:) is @MainActor, so code off the main actor creates it with await, and a switch over UpdateEvent needs the new writingResources and resourcesNotWritten cases.
.package(url: "https://github.com/ocean/FM1Kit.git", .upToNextMinor(from: "0.8.0")),
The package has two libraries: FM1Kit for iOS and macOS, and FM1Rescue for download mode, which works on macOS only and is empty on iOS.
Install a firmware
Read the package, check what installing it would do, then install it and follow its progress. Switching to a different firmware can erase the FM-1's projects and samples, so it needs confirming. With more than one FM-1 connected, devices() lists them so the person can choose one.
import FM1Kit
let package = try FwscPackage(data: Data(contentsOf: fileURL))
let updater = FM1Updater(transport: try CoreMIDITransport(clientName: "My App"))
let check = try await updater.check(package)
let confirmed = check.kind != .switchingFirmware || askToSwitch(from: check.device)
try await updater.install(package, options: InstallOptions(confirmsSwitchingFirmware: confirmed)) { event in
switch event {
case .writing(let fraction, _): print("Writing \(Int(fraction * 100))%")
case .finished(let identity): print("Now running \(identity)")
default: break
}
}
// Finish an update that was cut off, or one started in USB recovery mode.
if let identity = await updater.identify(), identity.isLoader {
try await updater.resume(package)
}
For apps aimed at everyone, InstallProgress folds those events into one bar that never goes backwards, in three stages: getting ready, installing and restarting. FM1Advice(for: error) turns any error into a headline, an explanation, whether the FM-1 is still fine, and one thing to do next. summary() describes the connected FM-1: its firmware's name and version, whether it's waiting part-way through an update, its USB serial number and, where the firmware reports it, its flash chip.
Firmwares built on fm1-base can carry resources, such as sounds, in their package. After a USB-MIDI install, FM1Kit asks the new firmware to write any the update loader left out, reported as writingResources. If the firmware can't, the install still finishes, after resourcesNotWritten, and writeResources(_:progress:) can send them later. InstallProgress counts writing them as installing.
An install finishes when the new firmware answers, even if the loader never asks to finish. If one is interrupted while writing, the FM-1's screen stays dark: keep it switched on and resume, as it may not start again until the update is finished.
Install m-bootloader
installBootloader(_:fromAnyFirmware:events:) installs m-bootloader from its fm1-uboot.fwsc package on an FM-1 running V15, keeping the firmware. With it, holding PLAY while switching on opens a recovery menu, holding REC starts download mode, and the firmware is checked before it starts. FM1Kit can't read the bootloader back over USB-MIDI, so the FM-1's screen confirms it. Installing V15 later puts M-VAVE's bootloader back.
Rescue an FM-1 in download mode
In download mode the FM-1 shows up as a USB disk. Taking it from macOS's disk driver needs root, so apps reach FM1Rescue through a privileged helper. A backup reads the 1 MB flash twice and checks both reads against the chip's CRC-32, and is saved as M-Flasher saves it, so either tool can restore it.
import FM1Rescue
try await updater.enterDownloadMode() // V15 or Felucca; or hold REC with m-bootloader
let session = try FlashSession(connection: USBDownloadModeConnection.open())
let backup = try session.backUp { print("\(Int($0 * 100))%") }
try backup.write(to: backupsFolder)
let plan = try FlashPlan.restoring(otherBackup, onto: backup)
print(plan.notes, plan.warnings, plan.sectors.count) // show it, then ask to confirm
try session.write(plan) { print("\(Int($0 * 100))%") }
session.close() // switch the FM-1 off and on to leave
A FlashPlan restores a backup, installs m-bootloader or M-VAVE's bootloader, or installs a firmware, changing only the 4 KB sectors that differ. Writing works from the top of the flash down, so a firmware's start-up code is replaced last. It checks the flash is still what was read, then checks every change against the chip's CRC-32. Another FM-1's backup never replaces this one's factory data, and nothing is written to flash from another model. Installing a firmware writes its resources too, or the plan's afterwards says to write them over USB-MIDI once it's running. If writing stops part-way, don't switch the FM-1 off: restore the backup.
Rescue an FM-1 through the FM-1 Transporter
An FM-1 that never reaches download mode, because no firmware starts on it, needs the chip's boot ROM. The FM-1 Transporter reaches it with an RP2040 board wired to the FM-1's USB data lines. Transporter works with it from a Mac, with no web app and no root: it waits for the FM-1 to be switched on, starts a flash loader, backs up, and writes a plan between 0x4000 and 0x92FFF, reading it all back afterwards. The Transporter can't write the saved data above that, so a plan that changes firmware says to install again in download mode once the FM-1 starts, erasing saved data.
FM1Kit starts m-bootloader's flash loader, which needs Transporter firmware not yet in a Transporter release. With the Transporter's v0.1.0, pass jl-uboot-tool's wl82loader.bin instead. FM1Kit's RECOVERY.md walks through it.
Topics
Packages
- structFwscPackage
Reads a
.fwscpackage: its identity, the image the device reads, its SHA-256, how it installs other firmwares, which flash chips it supports, and its resources. - structResourceRegion
A firmware's resources, such as sounds, in fm1-base's format, from a package or a
NAME-res.binfile. - structPackageCheck
A pre-release report on a package: its enciphering, flash chips, saved data, which firmwares will install it, and how people can switch back from it.
- structLeavingGuide
How to switch away from a firmware, worked out from its package before it's installed: the route to each destination, warnings to show first, and step-by-step instructions.
- structOfficialFirmware
Recognises M-VAVE's releases, V15, V16 and Open V12, by size and checksum, and says which may be included in an app (only V15).
- structFlashComparison
Two packages or backups compared part by part: the boot area, each file, each saved-data region and the factory data.
Devices
- structFM1Identity
Parses what a device reports, such as
FM-1_916, orota-FM-1_015for the update loader, and tells when a firmware may have shortened it, so the whole identity can be asked for. - enumFM1FlashChip
The FM-1's flash chips: the first units' P25Q80, and the UC25HQ80 in those sold since autumn 2026.
- structFM1Capability
What M-VAVE's open firmware reports about itself.
- structFM1BuildID
The build ID open firmware is armed with before an update.
- structFM1MessageDescription
Names a SysEx message to or from an FM-1 and what it carries.
Updating
- actorFM1Updater
Finds the device, or lets the person choose one of several, checks and installs, resumes, writes a firmware's resources, restores V15's voices, backs up open firmware, installs m-bootloader, and reports progress.
- structInstallCheck
What an install would do, before it starts.
- structInstallOptions
Confirms a switch of firmware, a reinstall of the identity already running, or V15 over a firmware that reports V15's identity, such as TransitFM1.
- enumUpdateEvent
Progress: staging, writing, a second pass with some firmwares, writing resources, and finished.
- structInstallProgress
An install's events as one bar that never goes backwards, in three stages.
- structFM1Advice
Any error in plain words: what happened, whether the FM-1 is fine, and what to do.
- structFM1DeviceSummary
The connected FM-1's firmware, version, update state, serial number and flash chip.
Bootloaders
- structBootloaderInstaller
m-bootloader's installer package, checked as the bootloader checks it.
- structBootloaderImage
The bootloader an installer carries, or a
.bootfile.
Backups
- structOpenFirmwareBackup
Open firmware's 16 project slots, the project being edited and its sample bank, saved as files M-VAVE's workbench can restore.
- structOpenFirmwareProject
One project, as a
.fm1file.
Transports
- classCoreMIDITransport
CoreMIDI connections to real devices.
- classSimulatedFM1
A software FM-1 that speaks the whole protocol and open firmware's project library, for the iOS Simulator and tests.
- classCoreMIDIVirtualDevice
Publishes a simulated FM-1 as virtual CoreMIDI ports, so other apps can talk to it as to an FM-1.
FM1Rescue (macOS)
- classUSBDownloadModeConnection
Download mode over USB mass storage. Needs root. Can wait for an FM-1 that only passes through download mode.
- classFlashSession
Uploads m-bootloader's flash loader, then reads, backs up and writes the flash.
- structFlashBackup
A whole-flash backup: which bootloader and firmware it holds, saved as M-Flasher saves it.
- structFlashPlan
A checked change to the flash, listing the sectors it writes, with notes and warnings. Installing a firmware can also erase every firmware's saved data.
- classSimulatedDownloadMode
The chip in software, erasing and writing as NOR flash does, for tests and previews.
- classTransporter
Works with an FM-1 through the FM-1 Transporter: waits for it, starts a flash loader, backs up and writes.
SerialTransporterLinkis its serial port, andSimulatedTransporterstands in for it in tests.
fm1probe
A Mac command-line tool for checking a setup, watching an install closely and checking firmware packages before release. In a terminal its output is styled, with warnings in colour and the next steps numbered at the end; in a pipe or with NO_COLOR set it's plain text. Only install, install-bootloader, restore-voices, write-resources, the flash- commands and transporter install and restore write to the device, and backup changes which project open firmware shows while it reads. Each asks you to type YES first, and the flash- and transporter commands save a backup before writing.
swift run fm1probe ports # list MIDI ports
swift run fm1probe devices # list the connected FM-1s
swift run fm1probe identify # ask the FM-1 what it's running
swift run fm1probe monitor 30 # name each message the FM-1 sends for 30 s
swift run fm1probe replay LOG.csv # print an install's --log file, naming each message
swift run fm1probe inspect FILE.fwsc # a package's identity, size, checksum, flash chips and resources
swift run fm1probe check FILE.fwsc # pre-release report for firmware developers (--strict for CI)
swift run fm1probe diff FIRST SECOND # compare two packages or backups, part by part
swift run fm1probe simulate FILE.fwsc # a simulated V15 on a virtual MIDI port, for testing updaters
swift run fm1probe install FILE.fwsc # install a firmware
swift run fm1probe write-resources FILE # write a firmware's resources from its NAME-res.bin or .fwsc
swift run fm1probe backup FOLDER # back up open firmware's projects and samples
swift run fm1probe install-bootloader fm1-uboot.fwsc # install m-bootloader from V15
swift run fm1probe download-mode # ask V15 or Felucca to restart into download mode
sudo .build/debug/fm1probe flash-backup FOLDER # read the whole flash
sudo .build/debug/fm1probe flash-restore BACKUP.bin FOLDER # put a backup back
sudo .build/debug/fm1probe flash-install FILE.fwsc FOLDER # install a firmware in download mode
swift run fm1probe transporter check # start the flash loader through the FM-1 Transporter
swift run fm1probe transporter backup FOLDER # back up through the Transporter
swift run fm1probe transporter install FILE.fwsc FOLDER # install through it
The flash- commands take --wait SECONDS for an FM-1 whose firmware crashes at start-up and passes through download mode by itself, only for a few seconds each time: they catch it as soon as it appears.
There are also transporter status, transporter restore BACKUP.bin FOLDER and transporter start, and the transporter commands take --loader wl82loader.bin for the Transporter's v0.1.0. devices, identify, inspect, check and diff take --json for scripts and CI. --port NAME on the commands that talk to an FM-1 finds a firmware that renames its USB port. fm1probe --version prints its version and fm1probe licences the licences of what it contains.
Recovery
Whenever the FM-1 is in its update loader, whether from USB recovery mode (hold OCT− while switching it on, on firmwares that offer it) or an interrupted update, resume(_:events:) can install a firmware.
Beyond that is the chip's USB download mode, from a computer, which works whatever the firmware. FM1Rescue uses it on a Mac; iPhones and iPads can't. V15 and Felucca can be asked to switch to it, and with m-bootloader installed, holding REC while switching on starts it. m-bootloader also opens its recovery menu by itself when the firmware fails its checks. An FM-1 stuck restarting can still be caught as it passes through download mode (USBDownloadModeConnection.open(waitingUpTo:)).
An FM-1 that shows nothing on USB, not even download mode, needs the chip's boot ROM, which the FM-1 Transporter reaches (see above).
See also
Source, documentation and changelog on GitHub
FM-1-RE: the reverse-engineering notes the protocol is written from.
m-bootloader and M-Flasher: the bootloader and download mode tools FM1Rescue follows. It builds in m-bootloader's flash loader (MIT), from its release v2.3.
FM-1 Transporter (MIT): the RP2040 rescue board FM1Rescue's Transporter works with.