p2b: a crash no longer turns 2 CORES off (snd8f's way: one core this power-on only); v0.9.9-par3

0.9.12's fallback (p1) left a unit on one core after a crash, three power-ons or for good: half the sound's room,
clicking under par1 and par2 where snd8f (always both) did not. The instruction counts are snd8f's within 2 %
(cpu_vg, every section). Now a crash is logged (ABOUT) and the cores stay; the second core given up while it plays
is this power-on only (fm1_mc_bar, as 0.6.71 .. snd8f); 1 CORE is MENU > SYSTEM > CORES's by hand. A unit left on
one core by the old fallback (CPU_AUTO) gets both back at its next power-on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
This commit is contained in:
Claude committed 2026-10-25 18:23:24 +00:00
1 parent 484c57b7af
commit d7b95dea0e
5 files changed
+30 -52

No files matched your search

+12 -21
View File
@@ -98,34 +98,25 @@ static int crash_log_get(char *b)
return b[4] == ' ' && (b[5] == '1' || b[5] == '2') && b[6] == 'C' && b[7] == ' ' && b[0] >= '?' && b[0] <= 'Z';
}
/* the boot's CPU setting after the last run: a crash or a hang while both cores ran turns 2 CORES off; (0.9.13) for
* three power-ons, then both cores again (cpu_retry: a crash in 0.9.12 left a unit on one core for good, every song past
* four tracks over its CPU); a crash again after that retry: for good (until MENU > SYSTEM > CPU) */
/* the boot's CPU setting after the last run. (p2b) A crash never turns 2 CORES off any more: on seq-v2 the crashes were
* the firmware's own (FX's nav_list), and one core halves the sound's room (0.9.12's fallback left units on one core,
* clicking, where snd8f kept both). A crash is logged (ABOUT); the second core given up while it plays is this power-on
* only (fm1_mc_bar, as 0.6.71 .. snd8f); 1 CORE stays MENU > SYSTEM > CORES's, set by hand. An old fallback (CPU_AUTO)
* is undone: both cores again */
static uint32_t cpu_after(uint32_t cfg, uint32_t crash_flags)
{
if (cfg & CPU_1CORE || !(crash_flags & CR_2C))
return cfg;
return (cfg & ~(uint32_t)CPU_WAIT) | CPU_1CORE | CPU_AUTO | (cfg & CPU_TRIED ? CPU_GOOD : 0u);
}
/* a power-on with no crash before it: one on one core after a crash counted, the third gives both cores back */
static uint32_t cpu_retry(uint32_t cfg)
{
uint32_t w = (cfg & CPU_WAIT) >> 3;
if ((cfg & (CPU_1CORE | CPU_AUTO | CPU_GOOD)) != (CPU_1CORE | CPU_AUTO))
return cfg;
if (w < 2u)
return (cfg & ~(uint32_t)CPU_WAIT) | (w + 1u) << 3;
return (cfg & ~(uint32_t)(CPU_WAIT | CPU_1CORE | CPU_AUTO)) | CPU_TRIED;
(void)crash_flags;
if (cfg & CPU_AUTO)
cfg &= ~(uint32_t)CPU_1CORE;
return cfg & ~(uint32_t)(CPU_AUTO | CPU_WAIT | CPU_GOOD | CPU_TRIED);
}
static uint32_t cpu_retry(uint32_t cfg) { return cpu_after(cfg, 0); }
/* 2 CORES off for good (cpu_after), saved, and said: why, then where to set it back (main.c: after a crash at boot, the
* second core given up while it plays) */
/* the second core given up while it plays: said, one core until the power-off (main.c) */
static __attribute__((noinline)) void cpu_off(const char *why)
{
cpu_cfg = (uint8_t)cpu_after(cpu_cfg, CR_2C);
settings_save();
ui_message(why);
str_cpy(ui.msg2, "MENU > SYSTEM > CORES", sizeof ui.msg2); /* (0.9.18: CPU CORES, was CPU) */
str_cpy(ui.msg2, "UNTIL SWITCHED OFF", sizeof ui.msg2);
}
static const char CPU_APPLY[] CPU_RO = "SWITCH OFF AND ON TO APPLY";
+1 -1
View File
@@ -38,7 +38,7 @@
#define FELUCCA_ID "FM-1_900" /* package identity (build.py: the .fwsc marker string) */
#endif
#ifndef FELUCCA_VERSION
#define FELUCCA_VERSION "v0.9.9-par2" /* (par2: 0.9.18's parity, phase 2: SEQ + SELECT dices with GEN's generator on the song's harmony (song_dice.c's own gone, -6 KB), GLO > LIVE (MANO, RIELES: the six sequences with live modifiers; the FX layer's 1/2 TEMPO and LOOPs are LIVE's), VOICE's Tracto vivo; the sound re-pinned) on (par1: 0.9.18's parity, phase 1: the app slot +2.7 KB, the event code built for size, live hits into repeating steps play once (Danil's rolls), USB STEMS+IN without the glitch / the mode on the first try / "JIANT", CLOUD without crackles, safe by default (CPU CORES, LAST CRASH), MIDI LEARN with MIDI MAP FACTORY / CUSTOM ADD / CUSTOM, DRUM-X held octaves slower, LOFI quieter, THEME, the FM6 bank guard, PRESETS by type; the sound re-pinned) on snd8: (snd5..snd8: STRING and ADD, their creatures TEJEDORA II and TOTEM, the master's TAPE, releases that no longer eat the next step, MIXER without a flash, GLO > SYSTEM 2: MIDI IN at a glance; 7.2 KB of flash and 3.8 kB of the pool freed) on gen3: the generator's rules by role (no lead at full sustain, every lead moving, plucks and stabs short, the filter's envelope on the basses and leads; accents, 1:4 / 3:4 components, MUTATE on the evolving parts), each genre after a reference, the parts given room round the drums (60 % of the energy at most) and the mix ~3 dB louder into the leveler; the step components' cards read whole (short names, LENGTH "8 ST"); on gen2: the generator tuned by ear: ACID HOUSE a 303 (X0X's Open303 / TB-3PO mapped onto ANALOG: the decay, a sustain, RES up to 120, the SLIDEs gliding ~55 ms in TIME, LEGATO, accents ~30 %, slides ~25 %) and first on the GENRE knob; the leads' vibrato shallow, fast and faded in; the drums shorter, less modulated, lower (48 % of the energy, was 74 %); on gen1: the song generator redesigned: a clean base each piece (NEW PROJECT's state), a sound archetype a role and a pattern grammar a genre (gen_tables.c), its code past the pinned sound; on snd4: S and M fonts at 2 sub-pixel phases (were 4: 12.9 KB of flash); the sound's flash layout pinned (tools/audio_layout.txt: the UI can shrink without moving it); sound beta B: the delay's DRIVE, the punch-in delay band-limited, LOOP 3 / 5 / 6 / 7, CLEAR AUTOMATION on PUNCH, MASTER last in FX, a lighter chorus; on snd1 */
#define FELUCCA_VERSION "v0.9.9-par3" /* (par2: 0.9.18's parity, phase 2: SEQ + SELECT dices with GEN's generator on the song's harmony (song_dice.c's own gone, -6 KB), GLO > LIVE (MANO, RIELES: the six sequences with live modifiers; the FX layer's 1/2 TEMPO and LOOPs are LIVE's), VOICE's Tracto vivo; the sound re-pinned) on (par1: 0.9.18's parity, phase 1: the app slot +2.7 KB, the event code built for size, live hits into repeating steps play once (Danil's rolls), USB STEMS+IN without the glitch / the mode on the first try / "JIANT", CLOUD without crackles, safe by default (CPU CORES, LAST CRASH), MIDI LEARN with MIDI MAP FACTORY / CUSTOM ADD / CUSTOM, DRUM-X held octaves slower, LOFI quieter, THEME, the FM6 bank guard, PRESETS by type; the sound re-pinned) on snd8: (snd5..snd8: STRING and ADD, their creatures TEJEDORA II and TOTEM, the master's TAPE, releases that no longer eat the next step, MIXER without a flash, GLO > SYSTEM 2: MIDI IN at a glance; 7.2 KB of flash and 3.8 kB of the pool freed) on gen3: the generator's rules by role (no lead at full sustain, every lead moving, plucks and stabs short, the filter's envelope on the basses and leads; accents, 1:4 / 3:4 components, MUTATE on the evolving parts), each genre after a reference, the parts given room round the drums (60 % of the energy at most) and the mix ~3 dB louder into the leveler; the step components' cards read whole (short names, LENGTH "8 ST"); on gen2: the generator tuned by ear: ACID HOUSE a 303 (X0X's Open303 / TB-3PO mapped onto ANALOG: the decay, a sustain, RES up to 120, the SLIDEs gliding ~55 ms in TIME, LEGATO, accents ~30 %, slides ~25 %) and first on the GENRE knob; the leads' vibrato shallow, fast and faded in; the drums shorter, less modulated, lower (48 % of the energy, was 74 %); on gen1: the song generator redesigned: a clean base each piece (NEW PROJECT's state), a sound archetype a role and a pattern grammar a genre (gen_tables.c), its code past the pinned sound; on snd4: S and M fonts at 2 sub-pixel phases (were 4: 12.9 KB of flash); the sound's flash layout pinned (tools/audio_layout.txt: the UI can shrink without moving it); sound beta B: the delay's DRIVE, the punch-in delay band-limited, LOOP 3 / 5 / 6 / 7, CLEAR AUTOMATION on PUNCH, MASTER last in FX, a lighter chorus; on snd1 */
#endif
#if FELUCCA_OTA && !FELUCCA_FLASH
#error "FELUCCA_OTA needs FELUCCA_FLASH"
+3 -2
View File
@@ -227,7 +227,7 @@ static __attribute__((noinline)) uint32_t cpu_boot(void)
}
cpu_cfg = (uint8_t)cpu_after(cfg, fl);
settings_save();
return cpu_cfg != cfg;
return 0; /* (p2b: a crash no longer turns 2 CORES off) */
#else
(void)fl; (void)cfg;
return 0;
@@ -277,7 +277,8 @@ static __attribute__((noinline)) uint32_t dbg_boot(void)
return cpu_boot();
}
#if FELUCCA_DUAL_CORE
/* (p1, main 0.9.12) the second core given up while it plays (a misread, no answer, a fault): 1 CORE for good, said once */
/* (p1, main 0.9.12) the second core given up while it plays (a misread, no answer, a fault): said once (p2b: one core
* until the power-off, not for good) */
static __attribute__((noinline)) uint32_t cpu_lost(uint32_t said)
{
if (fm1_mc_lost && said != 2u) {
+13 -27
View File
@@ -67,20 +67,12 @@ int main(void)
check(" the record is the row's 32 bytes, the settings around it untouched",
favorites.factory[8][31] == 0x11 && favorites.factory[10][0] == 0x22);
check("fallback: a crash with 2 CORES on turns it to 1 CORE (AFTER A CRASH), the clock kept",
cpu_after(CPU_320, CR_2C) == (CPU_320 | CPU_1CORE | CPU_AUTO) && cpu_after(0, CR_2C | CR_WDT) == (CPU_1CORE | CPU_AUTO));
check(" a crash on one core, or already 1 CORE (set by hand): unchanged",
cpu_after(0, 0) == 0 && cpu_after(CPU_1CORE, CR_2C) == CPU_1CORE && cpu_after(CPU_320, CR_WDT) == CPU_320);
{ /* (0.9.13) the fallback lasts three power-ons, then both cores again; a crash after that retry: for good */
uint32_t c = cpu_after(CPU_320, CR_2C), c1 = cpu_retry(c), c2 = cpu_retry(c1), c3 = cpu_retry(c2), c4 = cpu_after(c3, CR_2C);
check("(0.9.13) after a crash: 1 CORE for two clean power-ons, the third both cores (the clock kept)",
(c1 & CPU_1CORE) && (c2 & CPU_1CORE) && !(c3 & (CPU_1CORE | CPU_AUTO)) && (c3 & CPU_TRIED) && (c3 & CPU_320));
check(" a crash with both cores again after the retry: 1 CORE for good (no retry), MENU > CPU clears it all",
(c4 & (CPU_1CORE | CPU_AUTO | CPU_GOOD)) == (CPU_1CORE | CPU_AUTO | CPU_GOOD) && cpu_retry(c4) == c4 &&
cpu_retry(CPU_1CORE) == CPU_1CORE && cpu_retry(0) == 0);
cpu_cfg = (uint8_t)c4; cpu_put(0, 1);
check(" MENU > SYSTEM > CPU 2 CORES by hand: the crash state gone", cpu_cfg == CPU_320);
}
check("(p2b) a crash with 2 CORES on keeps 2 CORES (logged only), the clock kept",
cpu_after(CPU_320, CR_2C) == CPU_320 && cpu_after(0, CR_2C | CR_WDT) == 0);
check(" 1 CORE set by hand: kept; an old fallback (AFTER A CRASH, for good or waiting): both cores again",
cpu_after(CPU_1CORE, CR_2C) == CPU_1CORE && cpu_retry(CPU_1CORE) == CPU_1CORE &&
cpu_retry(CPU_1CORE | CPU_AUTO | CPU_320) == CPU_320 && cpu_retry(CPU_1CORE | CPU_AUTO | CPU_GOOD) == 0 &&
cpu_retry(CPU_1CORE | CPU_AUTO | (1u << 3)) == 0 && cpu_retry(CPU_TRIED) == 0);
cpu_cfg = 0;
mc_host = 1;
@@ -105,25 +97,19 @@ int main(void)
!strcmp(cpu_status(), "CORES 1 (AFTER A CRASH)") && (cpu_cfg = CPU_1CORE, !strcmp(cpu_status(), "CORES 1 (MENU > CORES)")) &&
(cpu_cfg = 0, !strcmp(cpu_status(), "CORES 1")) && (mc_host = 1, !strcmp(cpu_status(), "CORES 2")));
{ /* the boot after a crash beside core 1 (main.c cpu_boot, then the UI's start: cpu_off), and the second core given
* up while it plays (the main loop: cpu_off) */
uint32_t cfg = 0;
{ /* the boot after a crash beside core 1 (main.c cpu_boot: logged, nothing said), and the second core given up
* while it plays (the main loop: cpu_off, this power-on only) */
memset(favorites.factory[9], 0, 32);
saves = 0;
cpu_cfg = (uint8_t)cfg;
cpu_cfg = 0;
crash_log_put(CR_2C, 1, 0x0201ABCDu, 0x02012345u, 0, 1u << 21);
cpu_cfg = (uint8_t)cpu_after(cpu_cfg, CR_2C);
settings_save();
k = cpu_cfg != cfg;
if (k)
cpu_off("2 CORES OFF AFTER A CRASH");
check("boot after a crash with 2 CORES: logged, 1 CORE for good, saved, said with where to undo it",
k && cpu_cfg == (CPU_1CORE | CPU_AUTO) && saves == 2 && crash_log_get(b) && !strncmp(b, "BU01 2C", 7) &&
!strcmp(ui.msg, "2 CORES OFF AFTER A CRASH") && !strcmp(ui.msg2, "MENU > SYSTEM > CORES"));
cpu_cfg = 0;
check("boot after a crash with 2 CORES: logged, saved, 2 CORES kept",
cpu_cfg == 0 && saves == 1 && crash_log_get(b) && !strncmp(b, "BU01 2C", 7));
cpu_off("CORE 2 FAILED: 1 CORE");
check("the second core given up while playing: 1 CORE for good, said",
cpu_cfg == (CPU_1CORE | CPU_AUTO) && !strcmp(ui.msg, "CORE 2 FAILED: 1 CORE"));
check("the second core given up while playing: said, until the power-off (the setting untouched, not saved)",
cpu_cfg == 0 && saves == 1 && !strcmp(ui.msg, "CORE 2 FAILED: 1 CORE") && !strcmp(ui.msg2, "UNTIL SWITCHED OFF"));
}
puts(ok_all ? "cpu_safe: all passed" : "cpu_safe: FAILED");
return !ok_all;
+1 -1
View File
@@ -254,7 +254,7 @@ if [ -f build/gen/felucca_tables.h ]; then
$CC -O1 -w -Ibuild/gen -Ifirmware/src -Itests -o "$OUT/stems_test" tests/stems_test.c -lm
run "STEMS (0.9.8): DICE songs, each stem = its track's solo render (FULL LITE ECO, CORES 1 / 2), the sum = the mix, the SLICER" "$OUT/stems_test"
$CC -O1 -w -o "$OUT/cpu_safe_test" tests/cpu_safe_test.c
run "CPU safety (p1, main 0.9.12 / 0.9.13): crash code, the crash record (row 9), 1 CORE after a crash, both again on the third power-on, MENU > SYSTEM > CPU CORES / CPU CLOCK" "$OUT/cpu_safe_test"
run "CPU safety (p1, main 0.9.12 / 0.9.13): crash code, the crash record (row 9), a crash logged (p2b: 2 CORES kept), MENU > SYSTEM > CPU CORES / CPU CLOCK" "$OUT/cpu_safe_test"
$CC -O1 -w -Ibuild/gen -Ifirmware/src -o "$OUT/ratchet_test" tests/ratchet_test.c -lm
run "RATCH: x1..x4 in a step (notes, chords, drum hits), gates, chance, swing, projects, user presets, CHANCE page" "$OUT/ratchet_test"
$CC -O1 -w -Ibuild/gen -Ifirmware/src -Itests -o "$OUT/live_test" tests/live_test.c -lm