M-VAVE FM1 & M-UPGRADE Analysis & MIDI SysEx Protocol Documentation

This document contains technical research, hardware details, and reverse-engineering results for the M-VAVE FM1 synthesizer (powered by the JieLi AC791N processor) and the M-UPGRADE-FM1.app (macOS) utility.


1. Hardware & Device Ecosystem Overview

1.1. Target Device & Processor

  • Target Device: M-VAVE FM1 (FM Synthesizer / MIDI Controller).

  • Processor SoC: JieLi AC791N (WL82 series, 32-bit RISC core).

  • Official Development Board: JL_AC79_DevKit V1.0 (AC791N evaluation kit).

    JL_AC79_DevKit V1.0

  • Synthesizer Product Page: Cuvave / M-VAVE FM-1 Product Page

  • Latest Available Synthesizer Firmware: FM-1.fwsc (v15 2026-07-30)

  • Firmware v15 Entropy Analysis: (Source Issue #1)

    Firmware v15 Entropy Analysis

  • M-VAVE Ecosystem: Many other M-VAVE audio products (MIDI foot controllers, audio interfaces, and digital pedals) use the same JieLi AC791N / AC69xx processor platform and share similar OTA firmware architectures.

1.2. Hardware PCB Characteristics

  • No Debug Ports / Jumpers: The M-VAVE FM1 PCB contains no exposed debug headers (JTAG, SWD, or UART debug pads).
  • No Recovery Buttons: There are no hidden jumper pins or physical recovery buttons on the board for forcing bootloader / DFU mode.
  • Firmware Update Vector: MIDI SysEx over USB is the only practical firmware update channel available on the device.

1.3. Device Disassembly & Case Opening Instructions

To open the physical enclosure of the M-VAVE FM1:

  1. Remove Bottom Screws: Unscrew 6 self-tapping screws from the bottom casing.
    • Hidden Screw: 5 screws are visible on the bottom surface; 1 screw is hidden in the center under the product sticker.
    • Rubber Feet: The rubber feet do NOT need to be unglued or peeled off (no screws are hidden under the rubber pads).
  2. Separate Housing Latches: After removing all 6 screws, carefully unclip the internal plastic retaining latches/snaps running along the bottom enclosure seam to separate the case halves.

2. Core Technical Findings

2.1. Does the firmware update occur over MIDI?

Yes, the firmware update occurs entirely over the MIDI SysEx protocol.

The application does not use dedicated USB DFU/CDC emulation or direct low-level raw flash access during standard operation. The entire process (from handshake to streaming every byte of firmware and preset data) is executed via USB MIDI SysEx messages using the RtMidi library on top of macOS CoreMIDI.

2.2. Where is the firmware file stored?

The firmware binary is embedded directly inside the native executable file.

There are no external .bin or .hex files in the resources directory. Inside the executable file M-UPGRADE-FM1, the firmware image is embedded:

  • Internal Resource Name: usb_hid_ota.bin (offset 0xEEDDC).
  • Container Format: Signatures @JMUA (offset 0xF3BB8) and JLUFW (offset 0xF3CDC).

2.3. Is Signature Verification implemented?

Asymmetric cryptographic signature verification (RSA/ECDSA/AES) is NOT implemented.

Security checks include:

  1. Container Header & Signature Validation: Verification of @JMUA / JLUFW signatures, target device type, and version strings.
  2. Size Boundaries Validation: Embedded firmware too small: %1 bytes (min %2).
  3. Checksums (CRC/Byte Checksums): Every block transmitted via SysEx is accompanied by a byte checksum.

3. M-UPGRADE-FM1 Application Architecture

  • UI Framework: Qt6 (MainView, SelectFile, LoadingWidget).
  • MIDI Stack: RtMidi (RtMidiIn, RtMidiOut, MidiInCore, MidiOutCore).
  • OTA Update Worker Modules:
    • OtaUpgradeWorker: Background worker managing the two-step firmware flashing process.
    • PresetUpdateWorker: Background worker handling preset bank uploads.
    • OtaFormat: Utility class responsible for packing (pack), parsing (parse, tryParse), and building metadata frames (buildMetaSequence).

4. MIDI SysEx Commands & Interaction Scenarios

4.1. Handshake & Device Detection Trace

  • Purpose: Query connected devices for FM1 identity and status.
  • Captured MIDI Log Trace:
To USB Composite Device    SysEx 10 bytes:  F0 00 32 45 00 00 00 40 7F F7
From USB Composite Device  SysEx 41 bytes:  F0 00 32 45 58 01 00 00 23 4D 5A 44 XX XX XX XX XX 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 06 F7

Parameter Query Fuzzing Note:
Exhaustive read scanning across all Parameter IDs (0x00 through 0x7F with command 0x7F) confirmed that the M-VAVE FM1 synthesizer responds exclusively to Parameter ID 0x40 (64). Queries sent to all other Parameter IDs produce no response.

  • Detailed Trace Breakdown:

    • Outgoing Request Frame (10 bytes):

      • F0: SysEx Start.
      • 00 32 45: Manufacturer Header Prefix (_s_arrSysexHead).
      • 00: Channel / Device Broadcast ID (0x00).
      • 00 00 00: Parameter Address (0x000000).
      • 40: Parameter / Status Item (0x40 = 64).
      • 7F: Command Value (0x7F = 127 = Get Value / Status Query).
      • F7: SysEx End.
    • Incoming Response Frame (41 bytes):

      • F0 00 32 45: Header Prefix.
      • 58: Reply Command Type (0x58 ACK / Parameter Response).
      • 01: Device Subtype / Protocol Version.
      • 00 00: Echo Address (0x0000).
      • 23 4D 5A 44 XX ...: Serial Number & Device ID payload (contains ASCII bytes 4D 5A 44 -> MZD prefix; serial masked for privacy).
      • 40: Echo Parameter ID (0x40).
      • 06: Response Status / Checksum byte.
      • F7: SysEx End.

4.2. Step 1: Verification & Pre-check

  • Purpose: Transmit firmware metadata (version, length, checksum).
  • App Log: Sending upgrade mode command (first step - verification)
  • Flow: OtaFormat::buildMetaSequence constructs the metadata frame. The synthesizer verifies the metadata and enters bootloader/OTA mode.

4.3. Step 2: Start Upgrade Mode

  • Purpose: Trigger memory erase and Flash overwrite sequence on the microcontroller.
  • App Log: Sending upgrade mode command (second step - upgrade)
  • Flow: Upon ACK from device, launches the data chunk streaming thread.

4.4. OTA Data Chunk Streaming

  • Purpose: Stream binary firmware payload to Flash memory.
  • Flow: Slices binary data into chunks. Each chunk is packaged via OtaFormat::pack using 8-bit to 7-bit MIDI encoding (u8ToMidi).
  • Delivery Control: After sending each chunk, checks device status (Failed to get lower device request on timeout).

4.5. Preset Update

  • Purpose: Upload user patch banks to RAM / non-volatile memory.
  • Logic: Executed in "hot" mode without rebooting the synthesizer via PresetUpdateWorker.
  • App Log: Starting preset update, size=%1 bytes, device=%2

5. OtaFormat SysEx Frame Layout

Every SysEx message follows this layout:

[F0] [Manufacturer ID / Head] [Cmd Type] [Seq ID / Address] [Payload Data] [CRC / Checksum] [F7]
  • F0: Start of SysEx frame.
  • Header: Prefix ID (_s_arrSysexHead), specifying manufacturer and device model IDs (00 32 45).
  • Cmd Type:
    • 0x01 — Handshake & Metadata Verification.
    • 0x02 — Start Upgrade Mode.
    • 0x03 — OTA Firmware Data Chunk.
    • 0x04 — Preset Bank Data.
    • 0x58 — Device Response / Status ACK.
  • Payload Data: 7-bit encoded MIDI bytes (MSB packing).
  • F7: End of SysEx frame.

6. Memory Map, Bootloader & Custom Firmware Development

6.1. Bootloader Layout & Memory Offsets

In JieLi microcontrollers (AC791N / WL82 series):

  1. Mask ROM (ROM0): Hardwired ROM initiating chip reset.
  2. UBOOT (Bootloader): Located at SPI Flash physical address 0x00000000 (size 16 KB – 64 KB).
  3. Partition Table & Header (app_dir_head / isd_config.ini): Partition table and pin definitions (Power Pin, UART, SD).
  4. App Code Offset (app.bin): User application code starts at Flash offset 0x4000 (16 KB) or 0x10000 (64 KB) as specified by isd_config.ini.

6.2. Custom Firmware Support & CRITICAL Bootloader Re-entry Requirement

Flashing custom firmware via this protocol is fully supported, BUT requires strict adherence to bootloader re-entry logic:

Caution

CRITICAL BOOTLOADER RE-ENTRY REQUIREMENT:
Because the M-VAVE FM1 PCB lacks physical recovery buttons or debug pads, any custom firmware MUST retain or implement a mechanism to enter the bootloader / OTA mode (e.g. by listening for the SysEx verification/upgrade commands 0x01 / 0x02 or handling a button combination during startup).
If custom firmware is flashed without a bootloader entry handler, the device will be permanently soft-locked against future MIDI updates or rollback to stock firmware.

Requirements for compiling custom firmware:

  1. Toolchain: Official JieLi GCC toolchain targeting Pi32v2 / q32s architecture.
  2. Linker Script: Code must be linked at the target partition offset (origin Flash: 0x4000 / 0x10000).
  3. Bootloader Handler: Include the SysEx parser / OTA transition handler in the custom application code.
  4. Container Packaging (isd_tools): Package output binaries using isd_download / fw_pack into a UFW container with @JMUA / JLUFW headers.
  5. Flashing: The resulting UFW file can be transmitted via M-UPGRADE-FM1 or the custom Python script (fm1_flasher.py).

7. Binary References & Offsets

Binary offsets extracted from analysis:

  1. Native Application Binary:

    • Binary Path: M-UPGRADE-FM1
    • Offset 0xEEDDC: Resource path string usb_hid_ota.bin.
    • Offset 0xF14AD: Bootloader configuration block isd_config.ini, app_dir_head, uboot, POWER_PIN.
    • Offset 0xF3BB8: Container signature @JMUA.
    • Offset 0xF3CDC: JieLi firmware container magic JLUFW.
    • Offset 0x14C010: SysEx header data symbol _s_arrSysexHead.
  2. Supported Hardware & UBOOT Documentation:


8. Firmware Size Boundaries

Firmware size is constrained by three factors:

8.1. SPI Flash Capacity

AC791N chips feature 4 MB (32 Mbit) or 8 MB (64 Mbit) internal/external SPI Flash.

  • Layout:
    • UBOOT (Bootloader): First 16 KB – 64 KB (0x00000000 – 0x00010000).
    • VM / Flash DB (Settings): Final 16 KB – 64 KB of Flash.
    • User App Partition: Remaining space between UBOOT and VM.
  • Maximum Image Size: For 4 MB Flash, the maximum compiled image size is approximately ~3.9 MB.

8.2. Application Boundary Validation

  • Lower Limit: Embedded firmware too small: %1 bytes (min %2) (requires valid @JMUA header and >64 KB size).
  • Upper Limit: Protocol size field is 32-bit (up to 4 GB payload support).

8.3. Execution Model (XIP)

Code runs via XIP (Execute-In-Place) directly from SPI Flash via the MCU hardware cache. SRAM size limits dynamically allocated memory (.bss / .data), but does not restrict binary code size in Flash.


9. Python Flashing Utility (fm1_flasher.py)

A standalone CLI tool fm1_flasher.py implements this protocol. Project environment is managed via uv (configured in pyproject.toml).

Warning

UNTESTED UTILITY DISCLAIMER:
The Python flasher script (fm1_flasher.py) was developed strictly by reverse-engineering the native M-UPGRADE-FM1.app macOS application binary. This script HAS NOT been tested on physical M-VAVE FM1 hardware. Use with caution and at your own risk.

Features:

  • Automatic Firmware Extraction: Extracts embedded firmware from M-UPGRADE-FM1.app at offset 0xF3BB8 if no input file is supplied.
  • Custom Firmware Flashing: Accepts custom .bin / .ufw binaries via --file.
  • Preset Uploading: Uploads patch banks via --preset.

Example Commands:

# List available MIDI ports
uv run fm1-flasher --list

# Flash using embedded firmware
uv run fm1-flasher

# Flash custom firmware file
uv run fm1-flasher --file my_firmware.ufw

10. Firmware Disassembly & Reverse Engineering

Reverse-engineering JieLi microcontrollers (AC791N / WL82 / AC69x series) requires specialized tools due to JieLi's proprietary 32-bit RISC processor architectures (Pi32, Pi32v2, q32s).

10.1. Disassembly Tools & Ghidra Plugin

  • Ghidra Processor Module (ghidra-jieli): An open-source Ghidra processor module targeting JieLi CPU architectures:

    • pi32: Functional disassembly support for older JieLi chips.
    • pi32v2: Processor definition for AC791N (WL82 series). Enables Ghidra to parse function boundaries, construct control flow graphs (CFG), and trace MMIO register addresses (JL_PORTA, JL_PORTB, JL_PORTC).
    • q32s: Processor definition for BD19/BD29 series.
  • JieLi Official Toolchain (pi32v2-elf-objdump): Provides 100% accurate instruction decoding from the vendor SDK, used in combination with Ghidra for verifying complex instruction groups.


11. External References & Resources

Useful open-source tools, documentation, and SDK repositories:

  1. ghidra-jieli Repository: Ghidra processor extension for disassembling and decompiling JieLi pi32, pi32v2, and q32s CPU binaries.
  2. jl-uboot-tool Repository: Utility for interacting with JieLi UBOOT bootloaders over USB Mass Storage / SCSI pass-through.
  3. JieLi AC79 Official Peripheral Documentation: Official documentation covering AC79xx series peripheral hardware modules (SD controller, GPIO, UART, SPI, I2S).
  4. JieLi AC79 AIoT SDK (Gitee Repository): Official C SDK codebase for AC79 series (WL82 / AC791N) microcontrollers, containing board support packages (BSP), linker scripts, and hardware register headers.
Languages
Python 100%