mirror of
https://github.com/ruppert/fmini-1.git
synced 2026-12-05 12:24:36 +01:00
MENU > LARGE keeps one size per knob (#251): each knob shows all its values in the size its longest value fits, so a value no longer jumps between sizes while it is turned. No new fonts. Updates check the package's size on the device: the update entry and the update loader take only a package whose firmware area is exactly the FM-1's. Another device's package is refused before anything is erased (the update screen shows FAILED -15; the loader answers -14). Second core (beta, PR #247): MENU > SYSTEM > 2ND CORE, OFF by default. ON (BETA) applies from the next power-on: the second core renders some of the four parts of each block, bit for bit the one-core sound. A unit whose second core misreads goes on with one core and sets it back to OFF. FELUCCA_CPU2=0 builds none of it. Start, mailbox and guards from X0X (with Melodee's dual-core findings), the split and hardening after Jangada. Felucca-Engines: ANALOG, LOFI, TRIO, WHEEL and NOISE, the engine interface, the shared DSP helpers and their table generator move to https://github.com/hugelton/Felucca-Engines under the MIT licence, included as the git submodule firmware/engines. The firmware stays GPL-3.0-only; clone with --recurse-submodules. The sound is unchanged (the same golden renders); the engines' own tests run with Felucca's. Co-authored-by: Кирилл Сапфиров <gospodindilly@gmail.com>
54 lines
2.5 KiB
C
54 lines
2.5 KiB
C
/* SPDX-License-Identifier: GPL-3.0-only
|
|
* Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments */
|
|
/* Fuzz harness: random editor SysEx frames (with and without the header, any command, 0..1100 bytes, sometimes no
|
|
* terminator) and raw USB-MIDI packets through the real usb.c / editor.c paths of the host build. run_tests.sh runs
|
|
* it briefly under ASan / UBSan with a fixed seed. fuzz_ed [ITERATIONS [SEED]] */
|
|
#define EDITOR_TEST_NO_MAIN 1
|
|
#include "editor_test.c" /* hostsim, the stubs, RAM flash, reset() */
|
|
static uint32_t rs = 0x9E3779B9u;
|
|
static uint32_t rnd(void) { rs ^= rs << 13; rs ^= rs >> 17; rs ^= rs << 5; return rs; }
|
|
static void fz_feed(const uint8_t *p, uint32_t n)
|
|
{
|
|
uint32_t o, tries;
|
|
for (o = 0; o < n; o += 64u) {
|
|
for (tries = 0; tries < 50u && !ep1_take(p + o, n - o > 64u ? 64u : n - o); tries++) {
|
|
fm1_ms += 2u; ed_service(); host_drain();
|
|
}
|
|
}
|
|
}
|
|
int main(int argc, char **argv)
|
|
{
|
|
static uint8_t f[1300], u[2600];
|
|
uint32_t iters = argc > 1 ? (uint32_t)atoi(argv[1]) : 200000u, i, n, L, j, cmd, raw = 0, frames = 0;
|
|
if (argc > 2) rs = (uint32_t)atoi(argv[2]) | 1u;
|
|
reset();
|
|
usb.rx_pend = 0;
|
|
for (i = 0; i < iters; i++) {
|
|
uint32_t mode = rnd() % 16u;
|
|
if (mode == 0) { /* raw random USB-MIDI event packets */
|
|
uint32_t k = 4u * (1u + rnd() % 16u);
|
|
for (j = 0; j < k; j++) u[j] = (uint8_t)rnd();
|
|
ep1_take(u, k); raw++;
|
|
} else {
|
|
n = 0; f[n++] = 0xF0;
|
|
if (mode == 1) { f[n++] = (uint8_t)(rnd() & 0x7F); f[n++] = (uint8_t)(rnd() & 0x7F); f[n++] = (uint8_t)(rnd() & 0x7F); }
|
|
else { f[n++] = ED_HDR0; f[n++] = ED_HDR1; f[n++] = ED_HDR2; }
|
|
cmd = mode < 4u ? (rnd() & 0x7F) : 1u + rnd() % 70u;
|
|
f[n++] = (uint8_t)cmd;
|
|
L = rnd() % 4u == 0 ? rnd() % 1100u : rnd() % 40u;
|
|
for (j = 0; j < L; j++) {
|
|
uint32_t r = rnd();
|
|
f[n++] = (uint8_t)(r % 8u == 0 ? 0x7F : r % 8u == 1 ? 0 : r % 8u == 2 ? 1 : (r >> 8) & 0x7F);
|
|
}
|
|
if (rnd() % 32u) f[n++] = 0xF7; /* sometimes no terminator */
|
|
fz_feed(u, usb_frame(f, n, u)); frames++;
|
|
}
|
|
fm1_ms += 1u + rnd() % 40u;
|
|
ed_service(); host_drain();
|
|
if (rnd() % 64u == 0) { host_wire_n = 0; ed_sync(); host_drain(); }
|
|
|
|
}
|
|
printf("fuzz ok: %u frames, %u raw packets\n", frames, raw);
|
|
return 0;
|
|
}
|