Chocolate Plus Build from source

Home Custom Firmware Python Toolchain Patches
How the custom firmware 142 is made, and how to make it yourself.

For just getting the firmware, the patcher on the firmware page is easier: it does exactly the same in your browser. This page is for the command line, for checking what the patch does, and for changing the patch code. Everything starts from the original M-VAVE firmware 012, which is not included here: download FootCtrlPlus_012.fwsc from the M-VAVE Chocolate Plus page.

Patch with Python

  1. Install Python 3 from python.org (on Windows tick Add python.exe to PATH during setup). No extra packages are needed.
  2. Download the original firmware 012 (FootCtrlPlus_012.fwsc) from the M-VAVE Chocolate Plus page.
  3. Download the patch script: chocolate-plus-re (ZIP) and unpack it. You need the two files build.py and fwsctool.py from its firmware folder.
  4. Copy FootCtrlPlus_012.fwsc into that firmware folder.
  5. Open a terminal in that folder (Windows: type cmd in the Explorer address bar and press Enter) and run:
    python build.py FootCtrlPlus_012.fwsc
    On macOS and Linux use python3 instead of python.
  6. The script first checks that your file is exactly the original firmware 012, and stops with an error for any other file (another version, an incomplete download, or an already patched file). Then it applies the patches and writes FootCtrlPlus_142-dtnprt.fwsc into the same folder:
    OK: FootCtrlPlus_012.fwsc is the original firmware 012
    written: .\FootCtrlPlus_142-dtnprt.fwsc
    SHA-256: eadd20b993b149753651f83a683d1af25fb4f966d340e0b269a33b300f2e3ba2
    Identical to the official build. Flash it with SincoOTA (do not rename the file).
  7. Flash FootCtrlPlus_142-dtnprt.fwsc as described on the firmware page.

Options

-o <folder>output folder (default: the current folder)
--extrasalso write the .ufw (firmware without the Sinco wrapper), the decrypted patched app area FootCtrlPlus_142-dtnprt_app.bin and the decrypted original app area FootCtrlPlus_012_app.bin (offset 0 = address 0x01e00000, input of gen_table.py)

Checks on every run

Changing the patch code: JieLi toolchain

Only needed to change the assembler code of the patches. The assembled bytes are already contained in build.py, so building the firmware itself needs no toolchain. The pedal uses a JieLi AC636N (CPU core pi32v2); its compiler is the free JieLi toolchain.

Download (JieLi toolchain 2.5.3)

Linux / WSLjieli-linux-toolchains-20260730.1.tar.xz (26 MB) - used by the scripts here
SHA-256 a1545cddbc451a06bac43eb5cd96d831470c42a97c5c0b1f98879a20fc7647bd
Windows2.5.3.exe (53 MB, installer for the JieLi SDK build environment)
Official pagedoc.zh-jieli.com: tool versions (Chinese; newer versions may appear there)

Install (Linux, or WSL on Windows)

mkdir -p ~/jltc
tar -xJf jieli-linux-toolchains-20260730.1.tar.xz -C ~/jltc
~/jltc/jieli-linux-toolchains-20260730.1/pi32v2/bin/clang --version

The scripts expect it in ~/jltc/jieli-linux-toolchains-20260730.1. Elsewhere: set JL_TOOLCHAIN=/path/to/jieli-linux-toolchains-20260730.1.

Workflow

  1. Get the repository (ZIP or git clone https://github.com/dtnprt/chocolate-plus-re.git). Everything below runs in its firmware folder.
  2. Create the decrypted original app area (needed to check the original bytes at each patch location):
    python3 build.py FootCtrlPlus_012.fwsc --extras -o work
  3. Edit the patch code: patch_src/greet.s (boot greeting, bank display, status LED) with the addresses in patch_src/greet.ld. The footswitch tap fix is in patch_src/cave.s + link.ld.
  4. Assemble and link; the script prints the disassembly and the section addresses:
    bash patch_src/asm_greet.sh
  5. Copy the new bytes, together with the original bytes they replace, into the GREET table of build.py:
    python3 patch_src/gen_table.py work/FootCtrlPlus_012_app.bin
  6. Set a new VERSION in build.py (3 digits, also shown on the pedal) and build:
    python3 build.py FootCtrlPlus_012.fwsc --extras -o work
    The result now differs from the official build, so the script prints a warning instead of "identical".
  7. Check the patched code: ~/jltc/jieli-linux-toolchains-20260730.1/pi32v2/bin/objdump -d -print-imm-hex on the patched app area (or load work/FootCtrlPlus_*_app.bin at 0x01e00000 in a disassembler).

What the patch changes

Applied identically to both firmware copies in the file (flash.bin and the update bank flash2.bin). Addresses are CPU addresses (app area offset + 0x01e00000).

PatchWhereOriginalCustom
Footswitch debounceif (r1 < 4) @ 0x1e120344 ticks3 ticks (5 ms each)
Pending / combo windowif (r1 < 0xf) @ 0x1e1209015 ticks6 ticks
Short taps not droppedcall 0x1e26088 @ 0x1e12002 + 24-byte cave in free space taps under ~95 ms lostpress + release sent
Name / version reply27-byte slot @ 0x1e18c8eFootCtrlPlus_012FootCtrlPlus_142-dtnprt
Boot greetinghook @ 0x1e144ca → greetnormal screen blank, then version, battery percent and mode
Start screenmodes 2/3 @ 0x1e13a84 / 0x1e13aa0000blank
Space for the patchescall @ 0x1e15b06 removed; 0x1e1cc26 → 0x1e00100 timer function / 0xff block in usefreed (LRC calibration keeps its 10 ms period)
Status LED dimmedLED timer @ 0x1e129ee, display timer @ 0x1e11d78on = always lit lit 1/3 of the time at ~67 Hz
Advanced custom mode screen2 places @ 0x1e13064 / 0x1e13370 → bank_sw 0xy (2-digit bank, switch A-D)x-z (bank, -, switch 1-4)

Press latency: ~95 ms original, ~45 ms custom. A+B / C+D combos still work (30 ms window).

File format and checksums

Full notes (file formats, key, memory map, display, protocols): Firmware analysis.