V10.11: stock supply setup (DC-DC on) before the rails; BT segment reserved

- hal/fm1_power.h: the supplies as stock V15 sets them (LDO13 -> DCDC13, the
  analog bytes, VDDIO 3.2 V, VDC14 1.60 V, SYSVDD 1.38 V last), ported from
  Melodee (Kerem Kilic, GPL-3.0-only). main.c runs it at boot before
  fm1_rails_boot (which then finds the rails set). MENU > ABOUT shows "DC"
  when it took. The radio's prerequisite (docs/BLE_FEASIBILITY.md stage 2).
- 0xEA000..0xFBFFF (72 KiB) reserved for the Bluetooth segment (FL_EXT_*):
  outside FL_RANGE_OK already; the update loader's record sweep skips it.
- Emulator: stubs for the new supply setup.

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-31 18:28:22 +00:00
1 parent 8bc03cd85b
commit e373cbc191
8 files changed
+1862 -1778

No files matched your search

+5
View File
@@ -45,6 +45,11 @@ static inline void *fl_far(void *p) { void *volatile q = p; return q; }
#define FL_AUTO_HI 0x000E7000u /* the OTA staging */
#define FL_VBANK_LO 0x000E7000u /* (JIANT 0.6.11, Felucca 1.4.1) the FM6 voice bank (fm6_vbank.c), */
#define FL_VBANK_HI 0x000E8000u /* the sector above (below the stock OTA's VM backup, 0xE8000) */
/* (V10.11) 0xE8000..0xE9FFF the stock firmware's VM (the radio's RF trims, its BT address: kept, never written);
* 0xEA000..0xFBFFF (72 KiB) reserved for the Bluetooth segment (docs/BLE_FEASIBILITY.md: the BLE stack linked with
* JIANT, run from flash there). Nothing of the app writes either: they are outside FL_RANGE_OK below */
#define FL_EXT_LO 0x000EA000u
#define FL_EXT_HI 0x000FC000u
/* [off, off + n) inside [lo, hi), without wrapping: off + n can overflow, and
* the 1 MiB part ignores the high address bits, so a wrapped range lands low. */
#define FL_IN(off, n, lo, hi) ((uint32_t)(off) >= (lo) && (uint32_t)(off) <= (hi) && \
+71
View File
@@ -0,0 +1,71 @@
/* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2026 Kerem Kilic (Ellic Studio): the sequence, from Melodee's firmware/hal/fm1_power.h
* (https://github.com/keremimo/melodee, GPL-3.0-only); JIANT's port and comments, (C) 2026 Juan Ignacio Antonucci */
/* (V10.11) The FM-1's supplies set up as the stock V15 firmware does before its radio can start (docs/BLE_FEASIBILITY.md
* stage 2, step 2): the DC-DC for the 1.3 V rail on (LDO13 handing over to DCDC13), the analog configuration bytes,
* VDDIO 3.2 V, VDC14 1.60 V and SYSVDD 1.38 V last. Register order and values: stock app 0x02004F90..0x0200509A, as
* the AC79 SDK's __hw_power_init (Melodee's identification). JIANT had only the two core rails (fm1_rails_boot, which
* still runs after it and finds them set). Called once at boot with IRQs off and the second core held. A P33 transfer
* that times out stops the sequence where it is (no write of a dummy byte); 1 = done and read back as expected. */
#pragma once
#include <stdint.h>
#include "fm1_sys.h"
/* the stock delay(1000): its nop / increment / branch loop, not a time (the memory clobber keeps it between the P33
* operations) */
static inline __attribute__((always_inline)) void fm1_power_settle(void)
{
int32_t n = -1000;
__asm__ volatile("goto 2f\n1:\n\tnop\n\t%0 += 1\n2:\n\tif (%0 != 0) goto 1b" : "+r"(n) :: "memory");
}
static uint8_t fm1_power_ready; /* 1: the sequence ran and read back (MENU > ABOUT, console) */
static int fm1_power_field(uint32_t reg, uint32_t start, uint32_t width, uint32_t value)
{
uint32_t t = fm1_p33_timeouts, mask = ((1u << width) - 1u) << start;
uint8_t old = fm1_p33_read(reg);
if (fm1_p33_timeouts != t)
return 0;
fm1_p33_write(reg, (uint8_t)((old & ~mask) | ((value << start) & mask)));
return fm1_p33_timeouts == t;
}
static int fm1_power_init(void)
{
uint32_t t = fm1_p33_timeouts;
uint8_t mode, io, vdc14, sysvdd;
#define PW_STEP(op) do { op; if (fm1_p33_timeouts != t) return 0; } while (0)
#define PW_FIELD(reg, start, width, value) do { if (!fm1_power_field(reg, start, width, value)) return 0; } while (0)
PW_FIELD(0x00u, 2, 1, 1); /* LDO13 on during the handover */
fm1_power_settle();
PW_FIELD(0x00u, 3, 1, 1); /* DCDC13 on */
fm1_power_settle();
PW_FIELD(0x00u, 2, 1, 0); /* LDO13 off */
fm1_power_settle();
PW_STEP(fm1_p33_write(0x01u, 0x20));
PW_STEP(fm1_p33_write(0x05u, 0x40));
PW_STEP(fm1_p33_write(0x06u, 0x0C));
PW_STEP(fm1_p33_write(0x07u, 0xA5));
PW_STEP(fm1_p33_write(0x08u, 0x96));
PW_FIELD(0x09u, 4, 1, 1); /* SYSVDD drive */
PW_FIELD(0x05u, 0, 3, 4); /* VDDIOM 3.2 V */
PW_FIELD(0x06u, 0, 3, 7); /* VDC14 1.60 V */
PW_FIELD(0x05u, 4, 2, 3); /* VDDIOW 3.2 V */
PW_STEP((void)fm1_p33_read(0x06u)); /* (the stock's unused reads, in their place) */
PW_STEP((void)fm1_p33_read(0x05u));
PW_STEP((void)fm1_p33_read(0x05u));
PW_STEP(fm1_p33_or(0x00u, 0x80)); /* RC_250k_EN */
PW_FIELD(0x16u, 0, 6, 0); /* analog keep */
PW_STEP(fm1_p33_or(0x02u, 0x40)); /* VDDOK_DIS */
PW_STEP(fm1_p33_and(0x17u, 0xDF));
PW_FIELD(0x09u, 0, 4, 15); /* SYSVDD 1.38 V, last */
#undef PW_FIELD
#undef PW_STEP
mode = fm1_p33_read(0x00u); /* read back: no retry, no rollback */
io = fm1_p33_read(0x05u);
vdc14 = fm1_p33_read(0x06u);
sysvdd = fm1_p33_read(0x09u);
return fm1_p33_timeouts == t && (mode & 0x0Cu) == 0x08u && (io & 0x37u) == 0x34u && (vdc14 & 7u) == 7u &&
(sysvdd & 15u) == 15u;
}
+2
View File
@@ -172,6 +172,8 @@ static int ldr_session(void)
uint8_t r[80];
if (s - 0x1000u >= LDR_DATA_LO && s - 0x1000u < LDR_DATA_HI)
continue; /* Felucca's store: user data that may look like one */
if (s - 0x1000u >= 0xEA000u && s - 0x1000u < 0xFC000u)
continue; /* (V10.11) the Bluetooth segment: code, never a record */
if (ldr_fread(s - 0x100u, r, 80))
break;
if (ota_rd16(r + 6) == 0x5441u && ota_rd16(r) && ota_rd16(r) == ota_crc16(r + 2, 78, 0)) {
+2 -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 "V10.10" /* (2026-10-31) V10.10: the radio's calibration kept: the update loader keeps the stock VM sector (0xE8000: RF trims, BT address) but its record's 256 B; VM_READ (editor 80) reads that area for web/btcheck. (2026-10-31) V10.9: MENU > LARGE shows the animations (HOME: the six tracks' creatures in the strip; EDIT: the engine's). (2026-10-31) V10.8: testers' fixes: GEN parts set OFF stay off; GEN keeps its GENRE between visits; SEQ > STEP KNOB 4 VEL (1..127, then ACC SLD A+S); delay 1/4D 1/8D 1/16D; less pitch wobble from the generators (no macro on PITCH, pitched delay seldom, octaves); STOP TO EDIT says SONG PLAYS. (2026-10-31) V10.7: SEQ > EUCLID on a kit: LANE ALL first (DENSITY: a whole usable kit), a lane picked writes that lane alone; EDIT + PRESETS jumps between engines; the kit's SEQ dice plays in every genre; EUCLID's HITS exact (VARY moved them only); REC held alone and let go: UNDO (again: REDO). (2026-10-31) V10.6: SEQ > EUCLID and MODES (a euclidean pattern generator, melodies in the key) in MUTATE's place; MUTATE and SEQ TOOLS' RANDOM COOK BEAT gone. (2026-10-31) V10.5: automation thinned (a recording at the stop, the 64 when full) into holds and RAMPs. (2026-10-31) V10.4: ARRANGE / TIMELINE: OCT- deletes the row picked (DELETE ROW?). (2026-10-31) V10.3: TIMELINE: the lines between lanes soft (the block's colour, darker), the rows' edges stronger. (2026-10-31) V10.2: TIMELINE keeps the black line between lanes (only the rows touch); SAVE composes first: TIMELINE SECTIONS PROJECTS ARRANGE TOOLS USER PRESETS. (2026-10-30) V10.1: TIMELINE blocks fill the lanes (no black gaps between rows or tracks). (2026-10-30) JIANT FM V10: add15-beta6 as the new base (TIMELINE, VAR, ADD, official V16 both ways); the version history before it: the git log of the add15 line (codex/add15-private) */
#define FELUCCA_VERSION "V10.11" /* (2026-10-31) V10.11: the supplies set up as stock V15 does (the DC-DC on, hal/fm1_power.h from Melodee), the radio's prerequisite; 0xEA000..0xFBFFF reserved for the Bluetooth segment. (2026-10-31) V10.10: the radio's calibration kept: the update loader keeps the stock VM sector (0xE8000: RF trims, BT address) but its record's 256 B; VM_READ (editor 80) reads that area for web/btcheck. (2026-10-31) V10.9: MENU > LARGE shows the animations (HOME: the six tracks' creatures in the strip; EDIT: the engine's). (2026-10-31) V10.8: testers' fixes: GEN parts set OFF stay off; GEN keeps its GENRE between visits; SEQ > STEP KNOB 4 VEL (1..127, then ACC SLD A+S); delay 1/4D 1/8D 1/16D; less pitch wobble from the generators (no macro on PITCH, pitched delay seldom, octaves); STOP TO EDIT says SONG PLAYS. (2026-10-31) V10.7: SEQ > EUCLID on a kit: LANE ALL first (DENSITY: a whole usable kit), a lane picked writes that lane alone; EDIT + PRESETS jumps between engines; the kit's SEQ dice plays in every genre; EUCLID's HITS exact (VARY moved them only); REC held alone and let go: UNDO (again: REDO). (2026-10-31) V10.6: SEQ > EUCLID and MODES (a euclidean pattern generator, melodies in the key) in MUTATE's place; MUTATE and SEQ TOOLS' RANDOM COOK BEAT gone. (2026-10-31) V10.5: automation thinned (a recording at the stop, the 64 when full) into holds and RAMPs. (2026-10-31) V10.4: ARRANGE / TIMELINE: OCT- deletes the row picked (DELETE ROW?). (2026-10-31) V10.3: TIMELINE: the lines between lanes soft (the block's colour, darker), the rows' edges stronger. (2026-10-31) V10.2: TIMELINE keeps the black line between lanes (only the rows touch); SAVE composes first: TIMELINE SECTIONS PROJECTS ARRANGE TOOLS USER PRESETS. (2026-10-30) V10.1: TIMELINE blocks fill the lanes (no black gaps between rows or tracks). (2026-10-30) JIANT FM V10: add15-beta6 as the new base (TIMELINE, VAR, ADD, official V16 both ways); the version history before it: the git log of the add15 line (codex/add15-private) */
#endif
#if FELUCCA_OTA && !FELUCCA_FLASH
#error "FELUCCA_OTA needs FELUCCA_FLASH"
@@ -48,6 +48,7 @@
#include <stdint.h>
#include "fm1_time.h"
#include "fm1_sys.h"
#include "fm1_power.h" /* (V10.11) the stock supply setup (main.c, before the rails) */
#include "fm1_irq.h"
#include "fm1_guard.h"
#if FELUCCA_DUAL_CORE
+2
View File
@@ -506,6 +506,8 @@ void fm1_cstart(void)
#endif
for (s = _hot_load, d = _hot_start; d < _hot_end; s++, d++)
*d = *s; /* (0.6.78) core 0's hottest audio code (core.h HOTRAM) */
fm1_power_ready = (uint8_t)fm1_power_init(); /* (V10.11) the supplies as stock V15 sets them (the DC-DC on:
* hal/fm1_power.h, Melodee's sequence), the radio's prerequisite */
fm1_rails_boot(); /* (0.9.9-stab) the core supplies to M-VAVE's own levels (VDC14 1.60 V,
* SYSVDD 1.38 V, hal/fm1_sys.h) before the second core and the audio:
* up to here the chip ran on the boot loader's 1.26 V at 360 MHz */
+1 -1
View File
@@ -125,7 +125,7 @@ static __attribute__((noinline)) int32_t about_cpu(int32_t y, int draw)
fmt_int(n, fm1_rails[(i + 2u) & 3u]);
str_cpy(b + str_len(b), n, 4);
}
str_cpy(b + str_len(b), ")", 2);
str_cpy(b + str_len(b), fm1_power_ready ? ") DC" : ")", 5); /* (V10.11) DC: the stock supply setup took */
y = menu_text(b, y, T_TEXT, draw);
if (fm1_crash.magic == FM1_CRASH_MAGIC && fm1_crash.count) { /* (0.9.9-stab) the last crash since power-on
* (.noinit, hal/fm1_irq.h): what its red screen showed, in hex */
+1777 -1776
View File
File diff suppressed because it is too large. Load diff
+2
View File
@@ -225,6 +225,8 @@ static void fm1_reset_reason(void) {}
static void fm1_wdt_arm(uint32_t v) { (void)v; }
static void fm1_mailbox_clear(void) {}
static void fm1_rails_boot(void) {} /* (0.9.9-stab: the core supplies, hal/fm1_sys.h; none here) */
static uint8_t fm1_power_ready; /* (V10.11: the stock supply setup, hal/fm1_power.h; none here) */
static int fm1_power_init(void) { return 1; }
static void fm1_guard_enable(uint32_t m) { (void)m; }
enum { FM1_GUARD_STACK = 1, FM1_GUARD_WRITE = 2, FM1_GUARD_BUS = 4, FM1_GUARD_PC = 8 };
#if FELUCCA_CDC