CPU: after a crash, one core for three power-ons, then both cores again (a second crash: for good)

0.9.12 turned 2 CORES off for good after any crash with both cores at work: such a unit then played every song on
one core, ~1.5x the load of two at six tracks (host callgrind, a six-track scene: 2258-2508 instructions a sample on
one core against a ~1600 critical path on two), past four tracks over its CPU. Now the fallback lasts two clean
power-ons; the third starts both cores again (CPU_TRIED); a crash with both cores after that retry keeps 1 CORE for
good (ABOUT: CORES 1 (AFTER 2 CRASHES)) until MENU > SYSTEM > CPU. The settings byte takes the new bits (<= 127).

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-19 09:51:29 +00:00
1 parent be1bd2c8f6
commit 2a60cc34e8
5 files changed
+41 -10

No files matched your search

+21 -5
View File
@@ -17,7 +17,9 @@
#define FELUCCA_VERSION "0" /* (a host test without felucca.c) */
#endif
#define cpu_cfg (favorites.factory[15][17])
enum { CPU_1CORE = 1u, CPU_AUTO = 2u, CPU_320 = 4u };
enum { CPU_1CORE = 1u, CPU_AUTO = 2u, CPU_320 = 4u, CPU_WAIT = 8u | 16u, CPU_GOOD = 32u, CPU_TRIED = 64u }; /* (0.9.13:
* WAIT the power-ons on one core after a crash, 0..2; GOOD for
* good; TRIED both cores again after one) */
/* a crash's flags (main.c fm1_fault, cpu_boot): both cores ran, a hang (the watchdog), 320 MHz */
enum { CR_2C = 1u, CR_WDT = 4u, CR_320 = 8u };
/* the record: 32 characters, as MENU > ABOUT shows them, "IL01 2C 0.9.12 0201ABCD 0201ABCD": the short code and the
@@ -90,10 +92,24 @@ static int crash_log_get(char *b)
return b[4] == ' ' && 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 for good */
/* 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) */
static uint32_t cpu_after(uint32_t cfg, uint32_t crash_flags)
{
return !(cfg & CPU_1CORE) && (crash_flags & CR_2C) ? cfg | CPU_1CORE | CPU_AUTO : cfg;
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;
}
/* 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
@@ -115,12 +131,12 @@ static void cpu_put(uint32_t clock, uint32_t v) /* (from the next start: main.
if (v != cpu_get(clock))
ui_message(CPU_APPLY);
cpu_cfg = (uint8_t)(clock ? (v ? cpu_cfg | CPU_320 : cpu_cfg & ~CPU_320) :
(v ? cpu_cfg & ~CPU_1CORE : cpu_cfg | CPU_1CORE) & ~CPU_AUTO);
(v ? cpu_cfg & ~CPU_1CORE : cpu_cfg | CPU_1CORE) & ~(CPU_AUTO | CPU_WAIT | CPU_GOOD | CPU_TRIED));
}
/* MENU > ABOUT: the cores (fx.c mc_status, and why one: the MENU or a crash), the clock */
static const char *cpu_status(void)
{
if (!mc_live() && (cpu_cfg & CPU_1CORE)) /* (1 CORE set: core 1 never started) */
return cpu_cfg & CPU_AUTO ? "CORES 1 (AFTER A CRASH)" : "CORES 1 (MENU > CPU)";
return cpu_cfg & CPU_AUTO ? (cpu_cfg & CPU_GOOD ? "CORES 1 (AFTER 2 CRASHES)" : "CORES 1 (AFTER A CRASH)") : "CORES 1 (MENU > CPU)";
return mc_status();
}
+7 -2
View File
@@ -166,7 +166,7 @@ static void boot_leds(void)
/* (0.9.12) what the last run left (cpu_safe.c): a crash (a record newer than the last boot saw, boot_leds) or a hang
* (a watchdog reset: the main loop's breadcrumbs in PC / RETS, felucca_dbg) is logged into the settings (MENU > ABOUT
* LAST CRASH, the editor's backup); with both cores at work then, MENU > SYSTEM > CPU goes to 1 CORE for good. 1: that
* LAST CRASH, the editor's backup); with both cores at work then, MENU > SYSTEM > CPU goes to 1 CORE (0.9.13: for three power-ons, a second time for good). 1: that
* (the UI says so at its start) */
static __attribute__((noinline)) uint32_t cpu_boot(void)
{
@@ -182,8 +182,13 @@ static __attribute__((noinline)) uint32_t cpu_boot(void)
if (fl & CR_2C)
fm1_mc_bar_set(); /* (a hang beside the second core: as a crash, fm1_fault) */
crash_log_put(fl, 0xFFu, felucca_dbg.prev_stage, felucca_dbg.prev_page, 0, 0);
} else
} else {
cpu_cfg = (uint8_t)cpu_retry(cfg); /* (0.9.13) a clean power-on: after a crash, both cores again
* on the third */
if (cpu_cfg != cfg)
settings_save();
return 0;
}
cpu_cfg = (uint8_t)cpu_after(cfg, fl);
settings_save();
return cpu_cfg != cfg;
+1 -1
View File
@@ -58,7 +58,7 @@ static int settings_import(persist_t *p, int n)
p->favorites.factory[15][26] = 0;
if (p->favorites.factory[15][24] > 3u) /* MIDI OUT (JIANT 0.6.72, ui.c midi_out_mode): unknown = KEYS */
p->favorites.factory[15][24] = 0;
if (p->favorites.factory[15][17] > 7u) /* (0.9.12) MENU > SYSTEM > CPU, CPU CLOCK (cpu_safe.c cpu_cfg): unknown =
if (p->favorites.factory[15][17] > 127u) /* (0.9.12) MENU > SYSTEM > CPU, CPU CLOCK (cpu_safe.c cpu_cfg): unknown =
* 2 CORES, 360 MHZ (0, older settings too) */
p->favorites.factory[15][17] = 0;
if (p->favorites.factory[15][27] > 7u) /* SCREEN OFF (1.1.5, ui.c SCR_CODE): unknown = 0 (NEVER since 1.1.5.1) */
+10
View File
@@ -71,6 +71,16 @@ int main(void)
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);
}
cpu_cfg = 0;
mc_host = 1;
+2 -2
View File
@@ -179,8 +179,8 @@ int main(void)
for (b = 0; b < 256u; b++) {
p = original; p.favorites.factory[15][17] = (uint8_t)b;
memset(p.favorites.factory[13], 'A' + (int)(b % 26u), 32);
assert(settings_import(&p, sizeof p) == 1 && favorites.factory[15][17] == (b <= 7u ? b : 0u));
settings_export(&q); assert(q.favorites.factory[15][17] == (b <= 7u ? b : 0u) &&
assert(settings_import(&p, sizeof p) == 1 && favorites.factory[15][17] == (b <= 127u ? b : 0u));
settings_export(&q); assert(q.favorites.factory[15][17] == (b <= 127u ? b : 0u) &&
!memcmp(q.favorites.factory[13], p.favorites.factory[13], 32));
}
p = original; assert(settings_import(&p, sizeof p) == 1);